No module named Pwd - under Apache 2.2

durumdara durumdara at gmail.com
Fri Oct 21 04:51:05 EDT 2011


Hi!

Win7/x64, Python 3.2, PyPGSQL f 3.2 and Apahce 2.2.

I created a script that working in CGI mode, it is read some table,
and returns with an XML.

It was working with normal mode, under Pyscripter, and under command
line.

But!

When I trying to use it from Apache 2.2 as cgi, I got the subjected
error:

"No module named Pwd"

I checked the code.
Everything is fine for the lines
import postgresql # this is working
con = postgresql.open(....) # this failed

Traceback (most recent call last):
File "C:/web/Apache2.2/cgi-bin/testpg.py", line 20, in Session
Function()
File "C:/web/Apache2.2/cgi-bin/testpg.py", line 38, in WebFunction db
= postgresql.open("pq://postgres:m@localhost/webdbdb")
File "C:\python32\lib\site-packages\postgresql\__init__.py", line 76,
in open std_params = _pg_param.collect(prompt_title = None)
File "C:\python32\lib\site-packages\postgresql\clientparameters.py",
line 620, in collect cpd =
normalize(extrapolate(chain(*d_parameters)))
File "C:\python32\lib\site-packages\postgresql\clientparameters.py",
line 563, in normalize for (k, v) in iter:
File "C:\python32\lib\site-packages\postgresql\clientparameters.py",
line 524, in extrapolate for item in iter:
File "C:\python32\lib\site-packages\postgresql\clientparameters.py",
line 130, in defaults user = getuser() or 'postgres'
File "C:\python32\lib\getpass.py", line 156, in getuser import pwd
ImportError: No module named pwd

The Apache is running under my account (normal user).
The sys.path is ok:
['C:\\web\\Apache2.2\\cgi-bin', 'C:\\Windows\\system32\\python32.zip',
'C:\\python32\\DLLs', 'C:\\python32\\lib', 'C:\\python32', 'C:\
\python32\\lib\\site-packages']

So we (me, and the postgresql's author) don't understand, why it
happens.

Any idea?

Thanks for your help:
    dd



More information about the Python-list mailing list