How set PATH so Python engine can find specific DLLs?

5,867 views
Skip to first unread message

Mike Klein

unread,
Mar 3, 2014, 10:48:24 PM3/3/14
to pyscr...@googlegroups.com
I have been unable to get PyScripter to run a Python session that sets its search path (%PATH%) in a way that will find a set of DLLs required for running my project without setting %PATH% for the whole system (and making it difficult to remember to change it if the project location moves).

Example: Python 2.7.6 x86 installation.  Have a set of DLLs under C:\users\me\Documents\ProjX\lib that are required.  If I run Python in a command window after setting the PATH env variable, it runs correctly.  Setting %PYTHONPATH% does not cause Python to find the DLLs.  It requires setting %PATH%.

But I have not found any way to set %PATH% in a project-specific way that PyScripter will pick up and form the appropriate %PATH% for the Python interpreter it invokes when running the project.  If I use the built-in global environment variable settings through the Control Panel, everything works (after restarting PyScripter).

Using PyScript 2.5.3, Windows 7.

Is there a way to do this in a reasonably clean, project-specific way that doesn't require changing the global %PATH% variable setting?

Thanks....

PyScripter

unread,
Mar 28, 2015, 8:00:37 PM3/28/15
to pyscr...@googlegroups.com, mi...@kleinnet.com
You can provide run specific environment variables for an external run.  Run, Configure External Run...

When you use the remote interpreter you can add some code to the python_init.py start_up script  (Tools, Edit Start-up Scripts)
import os
os.environ['PATH'] += "..."
This code will be executed before your script runs and hopefully your script will find you DLLs.  (Have not tested)
See more information about the startup-scrips in the help file. (Customization, Initialization Files).
Reply all
Reply to author
Forward
0 new messages