bensing -
Joined: 25 Mar 2011 Posts: 1
|
Posted: Fri Mar 25, 2011 6:10 pm Post subject: Python "import cgi" not working (Python 2.7.1) |
|
|
Hi,
I've recently installed Abyss Web Server, and followed the instructions to enable Python 2.7.1.
I've 2 scripts in my document root, random.py and python-cgi.py (I'm learning python, and am starting to use the cgi module python provides).
So in python-cgi.py, the lines of code goes as follows:
Code: | #!/Python-2.7.1/python
import cgi
... |
However, upon accessing the file in my browser, it displays the contents of random.py, and nothing below the line "import cgi" is ever reached.
I have tried the following:
1) commented out the "import cgi" line and all lines requiring the cgi module; this results in the rest of python-cgi.py running normally
2) changing the shebang line to "#!/Python-2.7.1/python -u"; result is no difference
3) changing the arguments passed to the python interpreter in abyss web server; result is no difference
I would like to know if the problem can be resolved by changing a setting in Abyss Web Server.
This is the result of the cgi log file generated:
Code: | Traceback (most recent call last):
File "python-cgi.py", line 3, in <module>
import cgi
File "C:\Python-2.7.1\lib\cgi.py", line 51, in <module>
import mimetools
File "C:\Python-2.7.1\lib\mimetools.py", line 6, in <module>
import tempfile
File "C:\Python-2.7.1\lib\tempfile.py", line 34, in <module>
from random import Random as _Random
ImportError: cannot import name Random |
Any help is appreciated. Thank you! _________________ Benjamin |
|