Archive: Python Interpreter


Python Interpreter
Anybody know how to add modules to add python modules into a NSIS script and making them work with the Python interpreter by kichik
Right now when i try to run my ftp upload script it says

Python Exception:
No module named types.

So if somebody can tell me how to use i would be very greatful


I didn't write that. See the link on that page for more information.


ok But can anybody else tell me how to use this plugin i just cant seem to get the modules to work.


Contact the author of that plug-in.


Here's what I've done (probably including more than the minimum, but this got things running well).

I created a nsPython directory tree that has the following contents:
nsPython\
python22.dll
MFC42.DLL
MSVCIRT.DLL
MSVCRT.DLL

nsPython\Lib\
__future__.py
copy_reg.py
ntpath.py
os.py
site.py
stat.py
types.py
UserDict.py
UserList.py
UserString.py
string.py
dospath.py
shutil.py
re.py
sre.py
sre_compile.py
sre_constants.py
sre_parse.py

nsPython\DLLs\
_sre.pyd


In your .onInit function,
SetOutPath "$PLUGINSDIR"
File /r "nsPython\*.*"

At the top of your script, add to your ReserveFile lines:
ReserveFile "nsPython\*.dll"
ReserveFile "nsPython\Lib\*.*"
ReserveFile "nsPython\DLLs\*.*"



An 'easy' way to debug what supporting files you'll need is to include python.exe into the $PLUGINSDIR. Start your installation, and with it still running go into the $PLUGINSDIR with a command-prompt and run python interactively to test your code (running 'python -v' from the command-line will help resolve which modules you need just to load python w/out errors).