No module named pwd

5,295 views
Skip to first unread message

Vitaliy

unread,
Jun 23, 2008, 6:40:13 AM6/23/08
to Google App Engine
Hi
I'm using django (trunk) with GAE
I got strange exception on appspot (and there were no such exception
on dev_appserver (on windows))

ViewDoesNotExist at /presentations/library/
Could not import <some_my_module>. Error was: No module named pwd

I searched all my files for 'pwd'
and the only place where I found it is
django.contrib.auth.management.commands:

try:
import pwd
except ImportError:
default_username = ''

So this module not found exceptions is definitely not from here
there is no more files in my project that contains word 'pwd'

What is wrong ?

Marzia Niccolai

unread,
Jun 23, 2008, 5:02:02 PM6/23/08
to google-a...@googlegroups.com
Hi,
 pwd is a Python module (http://docs.python.org/lib/module-pwd.html) that is disabled with Google App Engine.

Please see:
http://code.google.com/appengine/kb/general.html#libraries

Thanks,
Marzia

conman

unread,
Jul 7, 2008, 10:36:31 AM7/7/08
to Google App Engine
I also got this error! I understand it is not allowed to import the
pwd module, but WHY is it imported at all?
This is my trace:

<class 'django.template.TemplateSyntaxError'>: Caught an exception
while rendering: No module named pwd

Original Traceback (most recent call last):
File "/base/data/home/apps/tucentrocks/1.48/django/template/
debug.py", line 71, in render_node
result = node.render(context)
File "/base/data/home/apps/tucentrocks/1.48/django/template/
debug.py", line 87, in render
output = force_unicode(self.filter_expression.resolve(context))
File "/base/data/home/apps/tucentrocks/1.48/django/template/
__init__.py", line 542, in resolve
new_obj = func(obj, *arg_vals)
File "/base/data/home/apps/tucentrocks/1.48/django/template/
defaultfilters.py", line 627, in date
return format(value, arg)
File "/base/data/home/apps/tucentrocks/1.48/django/utils/
dateformat.py", line 264, in format
return df.format(format_string)
File "/base/data/home/apps/tucentrocks/1.48/django/utils/
dateformat.py", line 29, in format
pieces.append(force_unicode(getattr(self, piece)()))
File "/base/data/home/apps/tucentrocks/1.48/django/utils/
dateformat.py", line 174, in r
return self.format('D, j M Y H:i:s O')
File "/base/data/home/apps/tucentrocks/1.48/django/utils/
dateformat.py", line 29, in format
pieces.append(force_unicode(getattr(self, piece)()))
File "/base/data/home/apps/tucentrocks/1.48/django/utils/
encoding.py", line 51, in force_unicode
s = unicode(s)
File "/base/data/home/apps/tucentrocks/1.48/django/utils/
functional.py", line 189, in __unicode_cast
return self.__func(*self.__args, **self.__kw)
File "/base/data/home/apps/tucentrocks/1.48/django/utils/translation/
__init__.py", line 62, in ugettext
return real_ugettext(message)
File "/base/data/home/apps/tucentrocks/1.48/django/utils/translation/
trans_real.py", line 290, in ugettext
return do_translate(message, 'ugettext')
File "/base/data/home/apps/tucentrocks/1.48/django/utils/translation/
trans_real.py", line 280, in do_translate
_default = translation(settings.LANGUAGE_CODE)
File "/base/data/home/apps/tucentrocks/1.48/django/utils/translation/
trans_real.py", line 200, in translation
default_translation = _fetch(settings.LANGUAGE_CODE)
File "/base/data/home/apps/tucentrocks/1.48/django/utils/translation/
trans_real.py", line 185, in _fetch
app = __import__(appname, {}, {}, [])
File "/base/python_dist/lib/python2.5/user.py", line 30, in <module>
home = os.path.expanduser("~/")
File "/base/python_dist/lib/python2.5/posixpath.py", line 320, in
expanduser
import pwd
ImportError: No module named pwd

I get this error only when visiting one specific view of my
application the first time. If I request it again with exact same
parameters I don't get it.

Any ideas what it could be?
Regards,
Constantin

Vitaliy

unread,
Jul 7, 2008, 10:53:24 AM7/7/08
to Google App Engine
As for me - bug was very stupid...
I had module named 'user'
then I deleted it, but 'import user' were stil inside my code
So it try to import standart python 'user' module and 'pwd' is
importing inside 'user'...

Try to check your code, may be you trying to import 'user' module to..
Reply all
Reply to author
Forward
0 new messages