473,387 Members | 1,501 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Add System Path?!?

Hello NG,

I have a GUI (written in wxPython) that calls some external exe files..
Some of them requires that I add to the PATH variable 1 directory. Basically,
the exe are located in:

/MyApp/Solvers/FirstExe
/MyApp/Solvers/SecondExe

And so on, while the dll needed by these exe are located in:

/MyApp/MyDll

These exe files do not work if I don't set the PATH variable also to that
adress. I know I can do it by hand (and also my users can), but I wonder
if there is a way to do it in Python...

Thank you for all suggestions/pointers.

Andrea.
Jul 18 '05 #1
3 2004
an***********@tin.it wrote:
These exe files do not work if I don't set the PATH variable also to that
adress. I know I can do it by hand (and also my users can), but I wonder
if there is a way to do it in Python...


You didn't mention what operating system you are using. On Unix, PATH
is an environment variable, and environment variables can be set in
a process and all child processes, but not in a parent process. So if
you can somehow arrange that the processes that need the PATH setting
are child processes of a Python interpreter, this could be possible.

If you were hoping that you invoke a Python script, and that modifies
the environments of already-running shells - that is not possible.

Regards,
Martin
Jul 18 '05 #2
rbt
an***********@tin.it wrote:
Hello NG,

I have a GUI (written in wxPython) that calls some external exe files.
Some of them requires that I add to the PATH variable 1 directory. Basically,
the exe are located in:

/MyApp/Solvers/FirstExe
/MyApp/Solvers/SecondExe

And so on, while the dll needed by these exe are located in:

/MyApp/MyDll

These exe files do not work if I don't set the PATH variable also to that
adress. I know I can do it by hand (and also my users can), but I wonder
if there is a way to do it in Python...

Thank you for all suggestions/pointers.

Andrea.


Check out the 'Path' value under this registry key:

"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Contr ol\Session
Manager\Environment"

You can import _winreg to edit it as you like. I think it's a string...
just append your path(s) to them.

rbt
Jul 18 '05 #3
an***********@tin.it a écrit :
Hello NG,

I have a GUI (written in wxPython) that calls some external exe files.
Some of them requires that I add to the PATH variable 1 directory. Basically,
the exe are located in:

/MyApp/Solvers/FirstExe
/MyApp/Solvers/SecondExe

And so on, while the dll needed by these exe are located in:

/MyApp/MyDll

These exe files do not work if I don't set the PATH variable also to that
adress. I know I can do it by hand (and also my users can), but I wonder
if there is a way to do it in Python...

Thank you for all suggestions/pointers.

Andrea.

Why not just adding in your app

import os
os.environ['PATH'] += ";the_new_adress_needed_by_exe"

this will just modify locally to your app the environement variable PATH

If you want to modify it for ever, just open a console DOS (cmd.exe) and
type:
set PATH=%PATH%;the_new_adress_needed_by_exe

Jul 18 '05 #4

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

Similar topics

6
by: gry | last post by:
I want to write some kind of install script for my python app that will add c:\cygwin\usr\bin to the system path. I don't want to walk around to 50 PC's and twiddle through the GUI to: My...
0
by: andrea_gavana | last post by:
Hello NG, sorry, I forgot to mention that I am on Windows... 2000 or XP, I don't think there will be any difference. Thank you! Andrea.
0
by: Shane | last post by:
I am working on an airline res system. The technologies I am using are a mysql backend with Java and JSP pages pulling information. It is quite straight forward on my system to for example book a...
1
by: darrel | last post by:
We've purchased a component that requires us to install two DLLs. One we add as a reference to our project, but the otherone we have to add to the 'environment setup' as a system path reference....
7
by: thisis | last post by:
Hi All, myGetImage.asp is suppose to create a temporary file in the client side, and display in on the client web browser. myGetImage.asp needs to know the clients web browser temporary...
0
by: Seemaraj | last post by:
hi to all I would like to store one of my file in windows system 32 folder while executing the application .Later i hav to check whether that file exists in the system path the next i execute it.....
3
by: Seemaraj | last post by:
Hi to all I would like to store one of my file in windows system 32 folder while installing my application.Later ,when i execute my application i need check whether that particular file exist or...
3
by: redefined.horizons | last post by:
I have been trying to find a way to add a directory to Python's sytem path on my MS Windows XP computer. I did some searching online, but the only solution I found involved editing the MS Windows...
0
by: cnathaide | last post by:
Hi, I have written a simple command line application in C# and created the accompanying setup project in VS 2005. When the user installs the application on the his/her machine, I would like...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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,...
0
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...

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.