473,767 Members | 1,873 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Set Environment for java based tools thru python script

Hello,

I run a Java app with subprocess from Python script. This python
script is called from another Python Wrapper.
python = subprocess.Pope n(["toolname.s h", "-args", arg1, arg2],
stdout=subproce ss.PIPE,
stderr=subproce ss.PIPE)

I can run it manually from the command line. But fails when I execute
the wrapper Python script

How do I source the java environment from the wrapper. It fails with
the following message.

....16605 Segmentation fault $JAVA_HOME/bin/java $JAVA_OPTIONS -
classpath $CLASSPATH xxxxxxxxxxxxxxx xxxxxxx "$@"....

Any Hints?

Thanks,
Sonika
Oct 14 '08 #1
1 2553
On Mon, Oct 13, 2008 at 05:07:16PM -0700, re*********@gma il.com wrote:
I run a Java app with subprocess from Python script. This python
script is called from another Python Wrapper.
python = subprocess.Pope n(["toolname.s h", "-args", arg1, arg2],
stdout=subproce ss.PIPE,
stderr=subproce ss.PIPE)
This (toolname.sh) looks like a shell script (though technically,
there's no reason it couldn't be a python script).

Unfortunately, from what you've written here, it's neither clear what
processes start what processes, nor what the intended result is. You
have said you have 3 programs, but you've only shown the interactions
between two of them. My suggestion would be to rewrite your request,
explicitly name the processes (even if it is just with letters, A, B,
and C), and show which processes start which other processes, and
probably explain a little about what each one is supposed to do. That
said, see below.
I can run it manually from the command line. But fails when I execute
the wrapper Python script

How do I source the java environment from the wrapper. It fails with
the following message.

...16605 Segmentation fault $JAVA_HOME/bin/java $JAVA_OPTIONS -
classpath $CLASSPATH xxxxxxxxxxxxxxx xxxxxxx "$@"....
Again, it's not clear what you're trying to do, but I'm assuming you
have some script that sets environment variables, and that's what you
mean by "source the java environment..."

If so, you can't. You either need to source the environment before
running the Python program, or have the python program read a file
that contains the environment and do its own parsing, setting the
environment variables appropriately. A child process, in general, can
not insert environment variables into the environment of its parent.

If what you're trying to do isn't covered by the above, then I think
you'll need to try to explain it better.

--
Derek D. Martin
http://www.pizzashack.org/
GPG Key ID: 0x81CFE75D
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.1 (GNU/Linux)

iD8DBQFI9R4jdjd lQoHP510RAuYuAK CPrawhj4wM12MDJ 9iLmxAGFUJGNACf TWWd
drXo2wnIm+2W/4OYQWtSrSo=
=XhmD
-----END PGP SIGNATURE-----

Oct 14 '08 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
3033
by: bezeee | last post by:
At my work we are in the process of building a tool to test an XML based API. Basically, XML in and XML out over http. Currently, there are two engines that do all of the schema validations, xml diffs, sending/receiving, etc. One of these engines in implemented in C# and the other in Java. Now the choice comes down to which scripting language we choose (Perl, Python or Jython) to tie into one of these engines. The scripting language...
15
2285
by: Ville Vainio | last post by:
Pythonic Nirvana - towards a true Object Oriented Environment ============================================================= IPython (by Francois Pinard) recently (next release - changes are still in CVS) got the basic abilities of a system shell (like bash). Actually, using it as a shell is rather comfortable. This all made me think... Why do we write simple scripts to do simple things? Why do we serialize data to flat text files in...
14
3306
by: Wolfgang Keller | last post by:
Hello, as a non-developer I am currently participating in an industrial "research" project to develop a so-called "web application". This application serves at the same time as middleware to connect several other "conventional" enterprise-applications such as ERP, SCADA etc. and to provide a GUI frontend to the users. The developers are into Struts, Enterprise Java Beans and the like, so it will be entirely implemented in Java with all...
9
3769
by: F. GEIGER | last post by:
I've dev'ed a Python prototype of an app, that besides the internals making it up has a gui. While test-driven dev'ing the app's internals in Python is fun as usual, dev'ing the GUI is not so funny, at least for me. I guess dev'ing a GUI in a test-driven way is not possible, or is it? I'm using wxPython, so if anyone has an idea... For now most of the time I extend and change the gui things, then run it, do the clicks to go thru the...
5
2325
by: TZESENG | last post by:
DECEMBER 13, 2005 . Editions: N. America | Europe | Asia | Edition Preference News Analysis By Steve Hamm Source: http://www.businessweek.com/technology/content/dec2005/tc20051213_042973.htm Peter Yared, CEO of software maker ActiveGrid, spent a critical chapter of his career steeped in Java, the programming language developed by Sun Microsystems (SUNW). In the late 1990s, Yared was chief technology officer
28
4330
by: liorm | last post by:
Hi everyone, I need to write a web app, that will support millions of user accounts, template-based user pages and files upload. The client is going to be written in Flash. I wondered if I coudl get your opinions - what do you think is the best language to use for the server? Python or Java? And I'm talking scalability, object oriented, development tools etc. Thansk for any idea! I'd love to hear it Happy New 2006,
4
2947
by: Richard Levasseur | last post by:
(Forewarning, most of these problems and solutions come from being the only developer in a 1 server department with no budget, few resources, unresponsive IT, and non-technical managers, so thats where I'm coming from.) (Additionally, this may or may not fit in this group, but I know there's bright people here, and it is largely PHP development centric) Any time I've done web development, I've always been plagued by some of the...
3
3013
by: altafur | last post by:
hi, i am using java with hibernate . i want to run a hibernate order by query thru java. i have written the query in hibernate.hbm.xml file. the query is as follows: query: SELECT distinct a.process_id, a.name name, a.category_id,c.parent_id FROM tbl_process_master a, tbl_category c where (lower(a.name) like :searchString or lower(a.description) like :searchString or lower(a.meta_tag) like :searchString ) and a.status=:status and...
0
10169
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10013
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9960
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8838
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6655
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5280
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5424
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3930
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3533
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.