473,287 Members | 1,419 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,287 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 2001
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: MeoLessi9 | last post by:
I have VirtualBox installed on Windows 11 and now I would like to install Kali on a virtual machine. However, on the official website, I see two options: "Installer images" and "Virtual machines"....
0
by: Aftab Ahmad | last post by:
Hello Experts! I have written a code in MS Access for a cmd called "WhatsApp Message" to open WhatsApp using that very code but the problem is that it gives a popup message everytime I clicked on...
0
by: Aftab Ahmad | last post by:
So, I have written a code for a cmd called "Send WhatsApp Message" to open and send WhatsApp messaage. The code is given below. Dim IE As Object Set IE =...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: marcoviolo | last post by:
Dear all, I would like to implement on my worksheet an vlookup dynamic , that consider a change of pivot excel via win32com, from an external excel (without open it) and save the new file into a...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...

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.