A
alain
Hi all,
Running python 2.5, i experience a strange behaviour with the
following code:import imputil
def handle_pye(fullpath, fileinfo, name):
# Print a debugging message
print 'Importing "%s" from "%s"' % (name,fullpath)
data = open(fullpath).read()
return 0, compile(data,fullpath,'exec'),{}
im = imputil.ImportManager()
im.add_suffix('.pye',handle_pye)
im.install() # THIS SEEMS TO DO WEIRD THINGS TO SUBSEQUENT
IMPORTS !!!!
import functools
I then get the following traceback:
Traceback (most recent call last):
File "D:\deleteme\New1.py", line 12, in <module>
import functools
File "C:\Python25\lib\imputil.py", line 103, in _import_hook
top_module = self._import_top_module(parts[0])
File "C:\Python25\lib\imputil.py", line 190, in _import_top_module
module = self.fs_imp.import_from_dir(item, name)
File "C:\Python25\lib\imputil.py", line 545, in import_from_dir
return self._process_result(result, fqname)
File "C:\Python25\lib\imputil.py", line 304, in _process_result
exec code in module.__dict__
File "C:\Python25\lib\functools.py", line 10, in <module>
from _functools import partial
File "C:\Python25\lib\imputil.py", line 106, in _import_hook
raise ImportError, 'No module named ' + fqname
ImportError: No module named _functools
The mere fact of installing a custom importer seems to break the
import functionality.
Alain
Running python 2.5, i experience a strange behaviour with the
following code:import imputil
def handle_pye(fullpath, fileinfo, name):
# Print a debugging message
print 'Importing "%s" from "%s"' % (name,fullpath)
data = open(fullpath).read()
return 0, compile(data,fullpath,'exec'),{}
im = imputil.ImportManager()
im.add_suffix('.pye',handle_pye)
im.install() # THIS SEEMS TO DO WEIRD THINGS TO SUBSEQUENT
IMPORTS !!!!
import functools
I then get the following traceback:
Traceback (most recent call last):
File "D:\deleteme\New1.py", line 12, in <module>
import functools
File "C:\Python25\lib\imputil.py", line 103, in _import_hook
top_module = self._import_top_module(parts[0])
File "C:\Python25\lib\imputil.py", line 190, in _import_top_module
module = self.fs_imp.import_from_dir(item, name)
File "C:\Python25\lib\imputil.py", line 545, in import_from_dir
return self._process_result(result, fqname)
File "C:\Python25\lib\imputil.py", line 304, in _process_result
exec code in module.__dict__
File "C:\Python25\lib\functools.py", line 10, in <module>
from _functools import partial
File "C:\Python25\lib\imputil.py", line 106, in _import_hook
raise ImportError, 'No module named ' + fqname
ImportError: No module named _functools
The mere fact of installing a custom importer seems to break the
import functionality.
Alain