• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Tim Cooke
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Devaka Cooray
  • Ron McLeod
  • paul wheaton
Saloon Keepers:
  • Tim Moores
  • Piet Souris
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Frits Walraven
  • Scott Selikoff

Java process builder not returning correct (or any) output

 
Bod McLeon
Ranch Hand
Posts: 146
Mac OS X IntelliJ IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am trying to use the UNIX 'which' command to find where a certain version of python is located.
It should be as simple as doing:

which (,for me,) will return

However, when I try and run this in java process builder, the exact output I get is:

This is the same when I read from both the error stream, and the input stream.
I tried so many variants of this command, such as:

(these output of all of these is the same as shown above)
even going as far as to do:

and, again, other variations of this.
I have tried different methods of splitting the command for process builder, such as:

All of these yield pretty much the exact same output.
However, the moment I do:

It outputs the correct directory fine.


Why is the output different in java? What is going on?

Note: I have also tried them all using:
 
Knute Snortum
Sheriff
Posts: 7123
184
Eclipse IDE Postgres Database VI Editor Chrome Java Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Can you post a SSCCE (that's a link) or at least the method with Runtime.getRuntime().exec() and the read from STDOUT in it?  Use .exec("which", "python3"); and post the output.
 
Bod McLeon
Ranch Hand
Posts: 146
Mac OS X IntelliJ IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Knute Snortum wrote:Can you post a SSCCE (that's a link) or at least the method with Runtime.getRuntime().exec() and the read from STDOUT in it?  Use .exec("which", "python3"); and post the output.


Here's the code:

And the output - well - that's non-existent (there is none - nothing is written to the console).
 
Knute Snortum
Sheriff
Posts: 7123
184
Eclipse IDE Postgres Database VI Editor Chrome Java Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
That's weird.  It works fine for me.
 
Knute Snortum
Sheriff
Posts: 7123
184
Eclipse IDE Postgres Database VI Editor Chrome Java Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Try putting this line
between lines 13 and 14 and see if you get some error output.
 
Bod McLeon
Ranch Hand
Posts: 146
Mac OS X IntelliJ IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Knute Snortum wrote:That's weird.  It works fine for me.


When I do .exec("which", "python"), as I mentioned in the first post, that is fine and I get an output.

Unfortunately putting that line in does not work.

I don't know where your python 3 is located, but mine is installed using PyEnv, so not the default install location. I'm not sure if that could be making any difference.
I decided to try it. My python 3.6 is installed normally under '/Library/Frameworks/Python.framework/Versions/3.6/bin/python3.6'
I ran .exec("which", "python3.6") but that did not work.
 
Knute Snortum
Sheriff
Posts: 7123
184
Eclipse IDE Postgres Database VI Editor Chrome Java Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The only thing I can think of is that the PATH environment variable is different when you run a Java program than when you run an interactive shell.  Try adding this line to your program:
 
Ron McLeod
Sheriff
Posts: 4006
549
Android Eclipse IDE TypeScript Redhat MicroProfile Quarkus Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Bod McLeon wrote:And the output - well - that's non-existent (there is none - nothing is written to the console).


Most likely an exception is being thrown, and you are simply ignoring it.  You should at least print the stack.  I would also printout the exit value:

Edit: updated code
 
Campbell Ritchie
Marshal
Posts: 76818
366
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I merged your stuff with the following thread. I hope that is okay by you.
 
Bod McLeon
Ranch Hand
Posts: 146
Mac OS X IntelliJ IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am trying to call a python script from Java.
I am using ProcessBuilder to call the python script and it does work (sort of)

It's very easy to call the python script on windows, by using the command 'python' which should point to the latest version of python.

On Mac, it's a bit harder. The 'python' command points to Python 2.7 who comes preinstalled on the computer (this version it too old for my script). To call a version of python 3, you need to run 'python3'. The problem is, there are many different ways you can do python version control, so on someones Mac, 'python3' may not call python. Or someone else may have the 'python' command set to point to the latest version of python (like me, using PyEnv).

I found the best way to find where a python version is located is using the 'which' command, which gives me the full path to the python install. ('which python / python3' both return '/Users/everyone/.pyenv/shims/python' for me)

Here's where the main problem is. For me, in terminal, both 'python' and 'python3' point to python 3.8. In process builder, 'python' points to python 2.7 and 'python3' doesn't even exist as a command. So when I try and do this:

It finished instantly with no output. Whereas this:

Returns '/usr/bin/python' which is the path to python 2.7

I have tried many, many different variation, of which here are a few:

And countless more. They all have also been tried using 'runtime.getruntime().exec'.

Why is the process builder different to normal terminal?
I actually was originally using 'runtime.getruntime().exec' and googled why the output was different. I found this StackOverflow post saying I should use process builder, but it still didn't work.

Thanks.
 
Campbell Ritchie
Marshal
Posts: 76818
366
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
How are you emptying the input and error streams from your Process? Have you combined them into one stream?

I think there is enough similarity to your previous posts that I should combine them into one th‍read, and this is too difficult a question for the “beginning” forum, so I shall move you to the “general” forum.
 
Bod McLeon
Ranch Hand
Posts: 146
Mac OS X IntelliJ IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Campbell Ritchie wrote:How are you emptying the input and error streams from your Process? Have you combined them into one stream?

I think there is enough similarity to your previous posts that I should combine them into one th‍read, and this is too difficult a question for the “beginning” forum, so I shall move you to the “general” forum.


No worries about merging and moving!

Not combining the streams, just reading them like this:

EDIT: Just read the whole thread - not sure why I never replied. It's the same problem again!
 
Campbell Ritchie
Marshal
Posts: 76818
366
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Bod McLeon wrote:. . . It's the same problem again!

Just as well I merged the two discussions.

Bod McLeon wrote:. . . . . .

Are you creating new Threads to empty those two streams? If not, the error stream may remain full for too long while you empty the input stream. Have you read the article by Michael Daconta called “When Runtime.exec() won't”? It is probably simpler to use a process builder and merge the two streams, but the principle of emptying both streams hasn't changed.
 
Bod McLeon
Ranch Hand
Posts: 146
Mac OS X IntelliJ IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Campbell Ritchie wrote:
Are you creating new Threads to empty those two streams? If not, the error stream may remain full for too long while you empty the input stream. Have you read the article by Michael Daconta called “When Runtime.exec() won't”? It is probably simpler to use a process builder and merge the two streams, but the principle of emptying both streams hasn't changed.


Ill see what merging the streams does.
 
Bod McLeon
Ranch Hand
Posts: 146
Mac OS X IntelliJ IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Campbell Ritchie wrote: It is probably simpler to use a process builder and merge the two streams


I have been doing some research, but I'm not sure how to merge the two streams. And what's it actually going to change? Surely the output would be the same, but I'm instead only reading one output, rather than 2.
My full code is:
 
Rob Spoor
Sheriff
Posts: 22700
129
Eclipse IDE Spring VI Editor Chrome Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Bod McLeon wrote:I have been doing some research, but I'm not sure how to merge the two streams.


redirectErrorStream(true) will make sure all error output (basically System.err) gets redirected (merged) to the standard output (basically System.out).

And what's it actually going to change? Surely the output would be the same, but I'm instead only reading one output, rather than 2.


If you read the article Campbell mentioned, you will see that the process you call will block if either its output buffer or its error buffer is full. In your code, you first try to read all of the output. This loop will only end if the process ends. If it's the error buffer that gets full, the process will block but never end. The first loop will therefore also never end. Your application is now blocked until you either kill the process you called, or your application itself.

By performing the redirect, you only have one stream that contains both normal and error output. The process' buffers will not fill up as long as you keep reading from the single stream.
 
Bod McLeon
Ranch Hand
Posts: 146
Mac OS X IntelliJ IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Rob Spoor wrote:

Bod McLeon wrote:I have been doing some research, but I'm not sure how to merge the two streams.


redirectErrorStream(true) will make sure all error output (basically System.err) gets redirected (merged) to the standard output (basically System.out).

And what's it actually going to change? Surely the output would be the same, but I'm instead only reading one output, rather than 2.


If you read the article Campbell mentioned, you will see that the process you call will block if either its output buffer or its error buffer is full. In your code, you first try to read all of the output. This loop will only end if the process ends. If it's the error buffer that gets full, the process will block but never end. The first loop will therefore also never end. Your application is now blocked until you either kill the process you called, or your application itself.

By performing the redirect, you only have one stream that contains both normal and error output. The process' buffers will not fill up as long as you keep reading from the single stream.



I see, that makes sense now. Thank you.

I instead used inheritIO() so it all goes to the console, but I'm sure it's pretty much the same. That seems to have fixed the issue of nothing being returned however it still isn't finding the correct executables. (it's like it isn't using system variables or something). Either way, I'm using a slight bodge to get around it:
I've written a simple python script that (should) work(s) on any python version. Within the script I just call the which / where command to locate the python install and print the output so I can use it in Java. I've done it for both Windows, and Mac (and Linux).
It seems that's the best way to do it, since I just want to finish this project because it's been too long.

Thanks anyway!
 
Bod McLeon
Ranch Hand
Posts: 146
Mac OS X IntelliJ IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Never mind, it doesn't work. The best way to describe what seems to be happening when i try and call a terminal command from java is that instead of just running the command, it creates a whole new Mac OS with nothing installed, no system / environment variables - nothing. Obviously it doesn't do that, but that's what it feels like.

My extremely simple python script, designed to work on any python version, doesn't work in Java.

This is the output from my terminal:

As can be seen, it successfully locates the latest python version, even when run from python 2 (python2). In Java:

(Note: for some reason in Java, 'python' -> python 2.7 even though it should be 3.8. That doesn't make any difference for my script anyway)
The moment I run it from Java, the output I get is:

Which is what I print when python isn't installed. But pretty clearly above, python 3 is installed.

And that's why I say "[it almost] creates a whole new Mac OS with nothing installed". In python I use the 'subprocess' which is basically process builder. When I just run form terminal the script it works. From java it doesn't because it's creating a new terminal process in the "new Mac OS" which has nothing installed on it. Again that's not what's happening but it's the best ay to describe it.

Why is process builder (and Runtime.getRuntime()) not creating a "real terminal"? It's extremely frustrating!
 
Knute Snortum
Sheriff
Posts: 7123
184
Eclipse IDE Postgres Database VI Editor Chrome Java Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I suspect the answer is that the PATH variable is different when you have an interactive shell than when you don't, although on macOS I'm not sure I can help you with that.
 
Bod McLeon
Ranch Hand
Posts: 146
Mac OS X IntelliJ IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Knute Snortum wrote:I suspect the answer is that the PATH variable is different when you have an interactive shell than when you don't, although on macOS I'm not sure I can help you with that.


It has definitely something to do with the PATH variable.
If I run 'printenv' in terminal, I get this:

The important part is the PATH variable.
When I run the exact thing in Java with:

I get this:

See how the path variable only has 4 items? The only thing I can ask is... why?
 
Knute Snortum
Sheriff
Posts: 7123
184
Eclipse IDE Postgres Database VI Editor Chrome Java Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Well, I hesitate to begin, because I really don't know masOS.  I know Linux and that's the kernel that macOS uses.  I know the bash shell, which is part of your environment.  Does anyone else know masOS specifically?

Okay, I'll proceed in a very cautious manner.  First you need to start a shell.  This might be called a command prompt or terminal.  Once there, type this:

   cat .bashrc

Copy and paste here what is printed on the screen.  We'll start from there.   (I may be in and out so don't expect an immediate response from me.)
 
Bod McLeon
Ranch Hand
Posts: 146
Mac OS X IntelliJ IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Knute Snortum wrote:Well, I hesitate to begin, because I really don't know masOS.  I know Linux and that's the kernel that macOS uses.  I know the bash shell, which is part of your environment.  Does anyone else know masOS specifically?

Okay, I'll proceed in a very cautious manner.  First you need to start a shell.  This might be called a command prompt or terminal.  Once there, type this:

   cat .bashrc

Copy and paste here what is printed on the screen.  We'll start from there.   (I may be in and out so don't expect an immediate response from me.)


Thanks for the reply. I feel like I know MacOS quite well, so I should be able help a little.

This is the full output:


 
Knute Snortum
Sheriff
Posts: 7123
184
Eclipse IDE Postgres Database VI Editor Chrome Java Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'm out of my depth, but let's try a few other things.

Is there a .bashrc or a .bash_login file?  Cat those if so.

Cat /etc/profile

What we're looking for is something that determines if you are running an interactive shell.  We want to append your Python path to the PATH variable even if the shell is not interactive.

If you try to do this yourself, backup the file first!
 
Bod McLeon
Ranch Hand
Posts: 146
Mac OS X IntelliJ IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Knute Snortum wrote:I'm out of my depth, but let's try a few other things.

Is there a .bashrc or a .bash_login file?  Cat those if so.

Cat /etc/profile

What we're looking for is something that determines if you are running an interactive shell.  We want to append your Python path to the PATH variable even if the shell is not interactive.

If you try to do this yourself, backup the file first!


Thanks for the reply!

I did manage to find a bash_rc file. The contents are below:


I couldn't find a bash_login file.

The contents of /etc/profile is also below:

 
Knute Snortum
Sheriff
Posts: 7123
184
Eclipse IDE Postgres Database VI Editor Chrome Java Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Just a thought before we do all this: What is you original intent?  If it's to use the Java program "in the wild", this won't work, because other people's PATH still might not contain the path to Python3.  But if it's just the execute a Python3 program from within Java, you can just use the full path to Python3 in your process builder.

If you still want to move ahead, read on:

Are you the only one who uses this computer?  If so, you can modify the global bashrc file.  Even if you are not, it probably won't hurt anyone else.  First backup the file.  I'll assume the you have to be root to do this:

   sudo cp /private/etc/bashrc /private/etc/bashrc.save

Then edit the file with nano, which is a pretty intuitive text editor.

   sudo nano /private/etc/bashrc

Now what you want to do is add your path to Python3 before you return from the script if you're not in an interactive shell.  So add something like this:

# System-wide .bashrc file for interactive bash(1) shells.
if [ -z "$PS1" ]; then
  # Add Python3 to PATH
  PATH=$PATH:/path/to/python3

  return
fi


Obviously, change /path/to/python3 to the real path.
 
Bod McLeon
Ranch Hand
Posts: 146
Mac OS X IntelliJ IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Knute Snortum wrote:Just a thought before we do all this: What is you original intent?  If it's to use the Java program "in the wild", this won't work, because other people's PATH still might not contain the path to Python3.  But if it's just the execute a Python3 program from within Java, you can just use the full path to Python3 in your process builder.


I started typing a response, but actually I have bitten back and thought about this more.
The whole reason I made this was because I wanted to run a python3 program from Java. On mac, python version are a bit sporadic, and are in many different places. There are things like PyEnv which are made for python version control allowing you to more easily use python from command line on a mac. Although this is great for developing, it makes getting the absolute python path even more difficult.
The easiest way to get the absolute python path is through the UNIX command 'which'. 'which python3' should and will give you the absolute path to the latest python version. (and this is where thing like PyEnv make it a little more difficult - although 3.8.1 is the latest version on my computer, 'which python3' actually returns the path to python 3.8.0, which isn't too big of a deal though)
And that bring me this this post, or at least my recent question on here - 'which python3' doesn't work on Java since Java doesn't seem to 'inherit' the environment variables.
On my mac, these are all the PATH variables:

PATH=/Users/everyone/.pyenv/shims:/Users/everyone/.pyenv/bin:/Applications/Wine Stable.app/Contents/Resources/wine/bin:/opt/local/bin:/opt/local/sbin:/Library/Frameworks/Python.framework/Versions/3.8/bin:/Library/Frameworks/Python.framework/Versions/3.4/bin:/Library/Frameworks/Python.framework/Versions/3.6/bin:/Library/Frameworks/Python.framework/Versions/2.7/bin:/Library/Frameworks/Python.framework/Versions/3.5/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Applications/VMware Fusion.app/Contents/Public:/usr/local/share/dotnet:/opt/X11/bin:~/.dotnet/tools:/Library/Frameworks/Mono.framework/Versions/Current/Commands:/Applications/Wireshark.app/Contents/MacOS:/Applications/Xamarin Workbooks.app/Contents/SharedSupport/path-bin

On Java, the only path variables are:

PATH=/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin
and that is the whole reason why 'which python3' doesn't work, since it can find 'python3' (and the reason I made this post)

Anyway, after doing my thinking, I believe the best bet will be to use whatever python version is located in /usr/local/bin. The main concern for me is that is someone has installed all their python versions using a version control like PyEnv, I believe (not sure because I haven't done that) there will either be no python in that folder, or just python 2.7 which is too old.

I am still open to figuring out a way to get the environment variables working, since I really dislike absolute paths since the often cause a lot of headaches.


As for the fix you provided, instead of setting the PATH like this: PATH=$PATH:/path/to/python3, with the absolute python path (which will become old as I update python and need changing) is there a way I can get the python path(s) from the global PATH variable? Like this:
global path variable:

PATH=/Users/everyone/.pyenv/shims:/Users/everyone/.pyenv/bin:/Applications/Wine Stable.app/Contents/Resources/wine/bin:/opt/local/bin:/opt/local/sbin:/Library/Frameworks/Python.framework/Versions/3.8/bin:/Library/Frameworks/Python.framework/Versions/3.4/bin:/Library/Frameworks/Python.framework/Versions/3.6/bin:/Library/Frameworks/Python.framework/Versions/2.7/bin:/Library/Frameworks/Python.framework/Versions/3.5/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Applications/VMware Fusion.app/Contents/Public:/usr/local/share/dotnet:/opt/X11/bin:~/.dotnet/tools:/Library/Frameworks/Mono.framework/Versions/Current/Commands:/Applications/Wireshark.app/Contents/MacOS:/Applications/Xamarin Workbooks.app/Contents/SharedSupport/path-bin

So the bashrc file would be:

# System-wide .bashrc file for interactive bash(1) shells.
if [ -z "$PS1" ]; then
 # Add Python3 to PATH
 PATH=$PATH:/Users/everyone/.pyenv/shims:/Users/everyone/.pyenv/bin:/Library/Frameworks/Python.framework/Versions/3.8/bin:/Library/Frameworks/Python.framework/Versions/3.4/bin:/Library/Frameworks/Python.framework/Versions/3.6/bin:/Library/Frameworks/Python.framework/Versions/2.7/bin:/Library/Frameworks/Python.framework/Versions/3.5/bin

 return
fi
 
Knute Snortum
Sheriff
Posts: 7123
184
Eclipse IDE Postgres Database VI Editor Chrome Java Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The problem will be that anyone else running the Java program will not have the same environment as you and the execute may fail.  I think you should consider why you are calling a Python program from Java at all.
 
Bod McLeon
Ranch Hand
Posts: 146
Mac OS X IntelliJ IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Knute Snortum wrote:The problem will be that anyone else running the Java program will not have the same environment as you and the execute may fail.  I think you should consider why you are calling a Python program from Java at all.


Mmmmm.

I created the GUI in Java at that time because I didn't know of any good python GUI drag and drop builders (I wanted D&D because it was supposed to be a quick project and coding the whole GUI from scratch is very time consuming) and because Java is cross-platform. I would have created the main processing script in Java, the problem is one of the python libraries I am using is python only, so I had to write the script in python.

I have recently come across the Qt GUI designer and was considering redoing the GUI in python. I started it but the further I dove, the more I realised how much of the processing script I would have to edit, and it would take away features like being able to call the python script from command line. I may well one day redo the GUI in another language (python?) but for now I think I will just have to hope the user hasn't installed all their python versions using a version control!

I also tried Jython but it doesn't support python 3 and it seems, although the developers want python 3 support, an update is just is a bur on the horizon.


Either way, I appreciate the help you have given me!
Thanks!
 
Knute Snortum
Sheriff
Posts: 7123
184
Eclipse IDE Postgres Database VI Editor Chrome Java Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Bod McLeon wrote: I would have created the main processing script in Java, the problem is one of the python libraries I am using is python only, so I had to write the script in python.


I'd be interested in what that library is.  You might be able to find a Java library for it.
 
Bod McLeon
Ranch Hand
Posts: 146
Mac OS X IntelliJ IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Knute Snortum wrote:

Bod McLeon wrote: I would have created the main processing script in Java, the problem is one of the python libraries I am using is python only, so I had to write the script in python.


I'd be interested in what that library is.  You might be able to find a Java library for it.


I'll explain.
I needed Reddit API wrapper for Python - PRAW! (python reddit api wrapper). There also exists many others like JRAW (java reddit api wrapper). The one major downside to this is that you need an API key to do anything with them, and I wanted my app to be as simple as possible, and not need the user to get an api key.

I did some digging and found PSAW (python pushshift.io api wrapper). You do not need an api key for this. My research has shown that there isn't a JSAW. I don't want to have to write a wrapper of Pushshift or the python script in Java, on top of re-writing the processing script (if I even do that)
 
Hey cool! They got a blimp! But I have a tiny ad:
the value of filler advertising in 2021
https://coderanch.com/t/730886/filler-advertising
reply
    Bookmark Topic Watch Topic
  • New Topic