Difference between 'import' and 'from ... import'

Andy Todd andy47 at halfcooked.com
Sun Dec 2 22:38:03 EST 2001


I'm having a problem with imports and would appreciate any hints, tips or 
pointers to documentation or faqs.

I've got a package installed in a directory on my PYTHONPATH and I cannot 
seem to import a module from that package directly. The directory is 
c:\python21\Gadfly and the module is gadfly.py. If I try;

>>> from Gadfly import gadfly

everything works and I can specify a connection and access my database. 
But, if I try;

>>> import gadfly

I get an error message;

Traceback (most recent call last):

  File "<interactive input>", line 1, in ?

SystemError: NULL result without error in call_object

I've tried googling for this error message but it seems to be a generic 
error which is masking my real problem.

This has got me a little stumped because the other modules in this package 
will import (e.g. sqlgen, sqlwhere) so I presume there is something in 
gadfly.py that the interpreter doesn't like.

The gadfly documentation only talks about 'from gadfly import gadfly' and 
I'm just wondering if there is something specific in the module which 
prohibits a direct import.

I'm running Python 2.1.1 on Windows98 with the latest version of gadfly 
from http://www.chordate.com/gadfly.html

Thanks in advance,
Andy
-- 
Content free posts a speciality



More information about the Python-list mailing list