Talk:NsPython plug-in: Difference between revisions
No edit summary |
No edit summary |
||
Line 1: | Line 1: | ||
== My Problem == | |||
Hello, | Hello, | ||
Line 5: | Line 6: | ||
I found out by using FileMon, that the '''module python files were searched in a subdirectory "python23.zip"'''. | I found out by using FileMon, that the '''module python files were searched in a subdirectory "python23.zip"'''. | ||
== Solution 1 == | |||
I am using the following '''source directory structure''' with the following files: | I am using the following '''source directory structure''' with the following files: | ||
<pre> | <pre> | ||
Line 38: | Line 40: | ||
With this setting I was able to use the nsPython plugin without problems. If you need other modules, you get an error message from the nsPython plugin naming the module. Simply copy the module.py file into the python23.zip/ directory. | With this setting I was able to use the nsPython plugin without problems. If you need other modules, you get an error message from the nsPython plugin naming the module. Simply copy the module.py file into the python23.zip/ directory. | ||
== Solution 2 == | |||
Another alternative is to adjust the python search path before importing additional libraries. Start your python file with (not tested yet) | |||
<highlight-python> | |||
import sys | |||
sys.path.append("./Lib/") | |||
import ... | |||
</highlight-python> | |||
where you specify the path containing the module files. | |||
== Questions ? Comments ? == | |||
If you have comments about this, mail me at wulmer{@}web{.}de | If you have comments about this, mail me at wulmer{@}web{.}de | ||
-- | --[[User:Wulmer|wulmer]] 14:06, 4 May 2007 (PDT) |
Revision as of 21:06, 4 May 2007
My Problem
Hello,
I had a problem that no modules were found by python23.dll, even the test installer in the ZIP file did not work with the external test.py file.
I found out by using FileMon, that the module python files were searched in a subdirectory "python23.zip".
Solution 1
I am using the following source directory structure with the following files:
./ ./nsPython/ ./nsPython/python23.dll ./nsPython/python23.zip/ ./nsPython/python23.zip/copy_reg.py ./nsPython/python23.zip/ntpath.py ./nsPython/python23.zip/os.py ./nsPython/python23.zip/shutil.py ./nsPython/python23.zip/stat.py ./nsPython/python23.zip/types.py ./nsPython/python23.zip/UserDict.py
In the NSI file, I have at the beginning:
ReserveFile "nsPython\python23.dll" ReserveFile "nsPython\python23.zip\*.*"
Then in .onInit I have:
Function .onInit InitPluginsDir SetOutPath "$PLUGINSDIR" File /r "nsPython\*.*" ...
With this setting I was able to use the nsPython plugin without problems. If you need other modules, you get an error message from the nsPython plugin naming the module. Simply copy the module.py file into the python23.zip/ directory.
Solution 2
Another alternative is to adjust the python search path before importing additional libraries. Start your python file with (not tested yet)
import sys sys.path.append("./Lib/") import ...
where you specify the path containing the module files.
Questions ? Comments ?
If you have comments about this, mail me at wulmer{@}web{.}de
--wulmer 14:06, 4 May 2007 (PDT)