This week's book giveaway is in the Reactive Progamming forum.
We're giving away four copies of Reactive Streams in Java: Concurrency with RxJava, Reactor, and Akka Streams and have Adam Davis on-line!
See this thread for details.
Win a copy of Reactive Streams in Java: Concurrency with RxJava, Reactor, and Akka Streams this week in the Reactive Progamming forum!
  • 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Junilu Lacar
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Knute Snortum
  • Tim Cooke
  • Devaka Cooray
Saloon Keepers:
  • Ron McLeod
  • Stephan van Hulst
  • Tim Moores
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Ganesh Patekar

Python Motu Command executes in terminal but not with Java

 
Ranch Hand
Posts: 1397
3
Netbeans IDE Spring Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,

I run the next command for downloading a data product andit works correctly in Linux Centos;



Then I try to run it from Java getting the next error;






Maybe the format in Java is incorrect?
 
Angus Ferguson
Ranch Hand
Posts: 1397
3
Netbeans IDE Spring Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There is another interesting scenario and it is when launching from Java a Python command line with the goal of downloading data.

It doesn't launch any error and it doesn't download the data but in the terminal it does it.


Any idea of what could be the issue?
 
Angus Ferguson
Ranch Hand
Posts: 1397
3
Netbeans IDE Spring Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In my view, it looks like the URL can not reach the "outside world" because it belongs to a process.



Do you know how to make it reach the "outside world"?
 
Bartender
Posts: 9584
13
Mac OS X Linux Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Angus Ferguson wrote:In my view, it looks like the URL can not reach the "outside world" because it belongs to a process.



I don't think that makes sense.  If the URL is reachable from the command line, it should be reachable from inside a process.

One issue I see is this code:

ProcessBuilder can take a String command or a String command followed String arguments.  I believe this command would fail because you passing "python -m motuclient..." as an argument to "python"

As we discussed before, you are not printing out the error stream.  
 
Angus Ferguson
Ranch Hand
Posts: 1397
3
Netbeans IDE Spring Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It is working for Windows but not Linux...

Windows



Linux

 
Joe Ess
Bartender
Posts: 9584
13
Mac OS X Linux Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Angus Ferguson wrote:It is working for Windows but not Linux...



That would not surprise me.  The Windows command line and Unix shell are not exactly functionally equivalent.  
I will say that I can execute the following:


So that would point to the issue being with the command to invoke Motu and not the Java or Python code.  I think using "bash" is superfluous in this case.
What does your current code look like and what is the output?
 
A wop bop a lu bob a womp bam boom. Tutti frutti ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!