Embedded Python and MySQLdb (was Re: PyApache and MySQLdb (was Re: anyone get one of the python apache modules to work with 2.1?))

Skip Montanaro skip at pobox.com
Wed Aug 29 16:15:10 CEST 2001

    >> 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):
            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

Skip Montanaro (skip at pobox.com)

More information about the Python-list mailing list