import types fails

Greg Fortune lists at gregfortune.com
Wed Aug 21 19:57:56 EDT 2002


A buddy and I have ended up with some code that causes a line like

import types
or
from types import DictType

to fail.  Failure in this case means an apparent deadlock.  The import line 
executes, but never returns.  This only occurs in a specific instance while 
using a couple of third-party libraries so I need to know what I can do to 
trace down the problem in the libraries.


Basically, what ways can Python be mangled so something simple like import 
types can deadlock or otherwise not work?  

1) Could this be a namespace issue?  
2) Could someone be messing with __import__ and cause this kind of 
behavior?  
3) Both libraries are linking against their own C code so could it be 
something the library writer did or did not do in the C code that is 
causing this?

I'm really not sure where to start digging right now so any help is 
appreciated.



If you're still with me and are interested in some details....
The libraries are MySQLdb and PyQt.  A MySQLdb cursor, which is established 
as a global in a wrapper module is being accessed from inside a QThread 
after a connection is established outside the thread.  When the cursor is 
executed, the execute function in cursors.py does a function level import 
(from types import ....).  It's that import that fails.  I've done a bunch 
of tests trying to determine where the problem might be hiding and some 
tests point at MySQLdb as the problem while other tests point at my code as 
the problem.  I've posted on the sourceforge forum for MySQLdb, but maybe 
you guys might have an idea of how an import can fail like that...


Greg Fortune





More information about the Python-list mailing list