Python configuration question when python scripts are executed using Appweb as web server.
gagsl-py2 at yahoo.com.ar
Tue Aug 4 02:42:47 CEST 2009
En Mon, 03 Aug 2009 11:04:07 -0300, IronyOfLife <mydevforums at gmail.com>
> I have installed python 2.6.2 in windows xp professional machine. I
> have set the following environment variables -- PYTHONPATH. It points
> to following windows folders: python root folder, the lib folder and
> lib-tk folder.
Why? Did you read it somewhere? Usually there is no need to set the
PYTHONPATH variable at all; remove it.
> I have configured IIS to execute python scripts.
> I do not have any issues executing python scripts from the python
> interpreter window or from the browser using IIS as the web server.
Try again after PYTHONPATH is removed, and make sure you can import all
the required modules from the Python console. Only then try to run the cgi
> However, when I use the open source Appweb web browser to execute
> python scripts. It is able to execute only simple script without
> issues. [...]However I am not able to execute python scripts that
> contain import
> statements. I need to point out here that i do not have issue with
> using os or sys packages. When I tried to execute the sample client
> script that came with the gnutls wrapper for python, I got error. I
> narrowed it down to the "from ... import" line in the example.
> from gnutls.crypto import *
> from gnutls.connection import *
Check that the above lines work fine from inside the Python console.
If not, something went wrong when you installed the gnutls Python package.
> Next step, in order to debug, I used the module finder to see what is
> happening. To being with I used the module finder to find out the
> modules loaded for the simple script hello.py.
Debugging cgi scripts isn't easy sometimes; try adding this line at the
start of your script:
You should get a nicely formatted stack trace whenever an exception is
raised. If you get an HTTP error instead (like 500 Internal Server Error)
it's likely a syntax error, you must fix it before continuing.
Then, you may find that modulefinder is no more needed.
> import pdb
pdb cannot work inside a CGI script; remove that.
> Once again, let me stress that this issue is happening only when I use
> appweb as the web server.
I don't know appweb, but if you first make sure the script works from the
command line, it should be much easier to make it work in the web server.
More information about the Python-list