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
Fri Aug 31 03:08:30 EDT 2001


On 08/31/01 Skip Montanaro uttered the following other thing:
> 
>     Brandon> Ok, here's the revelation:
>     Brandon> (<class exceptions.AttributeError at 0x817b59c>, <exceptions.AttributeError instance at 0x818a04c>, <traceback object at 0x8189b38> )
>     Brandon> AttributeError = <class exceptions.AttributeError at 0x80c807c>
>     Brandon> exceptions.AttributeError = <class exceptions.AttributeError at 0x817b59c>
> 
>     Brandon> Ie, exceptions.AttributeError and AttributeError don't match.
> 
>     Brandon> All that has to happen to cause this is to import the
>     Brandon> exceptions module.
> 
> Hmmm...  Works for me in 2.1.1:
> 
>     % python
>     Python 2.1.1 (#11, Aug 30 2001, 10:35:23) 
>     [GCC 2.96 20000731 (Linux-Mandrake 8.0 2.96-0.48mdk)] on linux2
>     Type "copyright", "credits" or "license" for more information.
>     >>> import exceptions
>     >>> exceptions.AttributeError 
>     <class exceptions.AttributeError at 0x80f217c>
>     >>> AttributeError 
>     <class exceptions.AttributeError at 0x80f217c>
> 
> I checked the 2.1.1 code.  It doesn't have a call to
> _PyImport_FixupExtension after the init_exceptions call.

You miss understand.  You have to do this in the context of the embedded
environment, ie where it creates an interpreter state than destroys it
before creating another one (ie, like PyApache does it)

Brandon
-- 
 " ... it's [Titanic] got the highest body-count of any other love 
       story I'm aware of ..." -- Newob Det, ASC
                                           http://www.fiction.net/blong/




More information about the Python-list mailing list