Join GitHub today
import web fails in embedded Interpreter #87
Since the embedded python interpreter perhaps has no arguments passed to it, the code fails. On commenting out the _is_dev_mode function internals, i can move on...
File "Tests.py", line 13, in
File "C:\Python27\lib\site-packages\web__init__.py", line 14, in
File "C:\Python27\lib\site-packages\web\wsgi.py", line 66, in
File "C:\Python27\lib\site-packages\web\wsgi.py", line 60, in _is_dev_mode
AttributeError: 'module' object has no attribute 'argv'
This comment has been minimized.
This comment has been minimized.Show comment Hide comment
Nothing wrong with the installation. The python interpreter library is embedded in a c++ based application. No python.exe but a python27.lib is used and the c api functions are called to instantiate and use the interpreter. This seems to be a common issue for libraries which are used with the embedded interpreter.
Of course i can make sure the attribute exists using PySys_SetArgvEx and then it runs, however i do not know if another library i use/will use has other side effects due to these command line parameters.
How about an interface which accepts name-value pairs as configuration info rather than from the command line?
For the embedded case i could make a patch for all usages of sys.argv where argv does not exist. Currently the following files are affected.