imputil.py, is this a bug ?

S

Stef Mientki

hello,

I get an error compiling with pyjamas, in the standard module imputil,
_import_top_module

Traceback (most recent call last):
File
"D:\Data_Python_25\PyLab_Works\pylab_works_programs\PyJamas_Test\Vraag_Test1.py",
line 22, in <module>
from Vragenlijsten import Get_Vragenlijst
File "P:\Python\Lib\site-packages\pyjd\imputil.py", line 109, in
_import_hook
top_module = self._import_top_module(parts[0])
File "P:\Python\Lib\site-packages\pyjd\imputil.py", line 217, in
_import_top_module
module = item.import_top(name)
AttributeError: 'unicode' object has no attribute 'import_top'

It seems that elements of sys.path can be of the type unicode

def _import_top_module(self, name):
# scan sys.path looking for a location in the filesystem that
contains
# the module, or an Importer object that can import the module.
for item in sys.path:
if isinstance(item, _StringType):
module = self.fs_imp.import_from_dir(item, name)
else:
module = item.import_top(name)
if module:
return module
return None

so by adding the next 2 lines, everything works ok.
elif isinstance ( item, basestring ) :
module = self.fs_imp.import_from_dir ( str(item), name)

is this a bug ?
(I'm using Python 2.5.2 on Windows )

thanks,
Stef Mientki
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Staff online

Members online

Forum statistics

Threads
473,995
Messages
2,570,230
Members
46,816
Latest member
SapanaCarpetStudio

Latest Threads

Top