Embedded Python and MySQLdb (was Re: PyApache and MySQLdb (was Re: anyone get one of the python apache modules to work with 2.1?))
Brandon Long
blong at fiction.net
Wed Aug 29 18:17:06 EDT 2001
On 08/29/01 Skip Montanaro uttered the following other thing:
>
> >> On the second request, the import of the site.py module fails (during
> >> import __builtin__) with:
> >> 'import site' failed; traceback:
> >> Traceback (most recent call last):
> >> File "/neo/opt/encap/python-2.1-nothread/lib/python2.1/site.py", line 60, in ?
> >> import sys, os
> >> File "/neo/opt/encap/python-2.1-nothread/lib/python2.1/os.py", line 54, in ?
> >> __all__.extend(_get_exports_list(posix))
> >> File "/neo/opt/encap/python-2.1-nothread/lib/python2.1/os.py", line 35, in _get_exports_list
> >> return list(module.__all__)
> >> AttributeError: 'posix' module has no attribute '__all__'
>
> Sounds like something's fishy in your os module. The current 2.1.1 code for
> _get_exports_list is
>
> def _get_exports_list(module):
> try:
> return list(module.__all__)
> except AttributeError:
> return [n for n in dir(module) if n[0] != '_']
>
> so it should be catching the AttributeError (the posix module is not
> supposed to have an attribute named '__all__'). What does _get_exports_list
> look like? Where are you picking up the os module? Try:
>
> import imp
> imp.find_module("os")
No, the module is unmodified and does contain the AttributeError
clause... but for some reason, it doesn't match the AttributeError
exception that is thrown. If I replace it with just except: to catch
all exceptions, it passes until further down where something else in
os.py expects an exception.
Brandon
--
"Mithras -- the Reason for the Season"
http://www.fiction.net/blong/
More information about the Python-list
mailing list