I have logged the import activity, modifying custom_import like this:
FORMAT="%s -> %-40s %-10s %-10s %-10s %-10s"
# if not relative and not from applications:
if hasattr(current, 'request') \
and level <= 0 \
and not name.split('.')[0] in INVALID_MODULES \
and isinstance(globals, dict):
print FORMAT % ("custom", name, hasattr(current, 'request'), level,name
.split('.')[0] in INVALID_MODULES, isinstance(globals, dict))
...
finally:
if import_tb:
import_tb = None
print FORMAT % ("native", name, hasattr(current, 'request'), level, name
.split('.')[0] in INVALID_MODULES, isinstance(globals, dict))
return NATIVE_IMPORTER(name, globals, locals, fromlist, level)
Here you see some of the data:
native -> random True -1
True True
custom -> nltk.data True -1
False True
native -> __future__ True -1
True True
native -> os True -1
True True
custom -> internals True -1
False True
native -> subprocess True -1
True True
native -> os True -1
True True
native -> os.path True -1
True True
native -> re True -1
True True
native -> warnings True -1
True True
native -> textwrap True -1
True True
native -> types True -1
True True
native -> sys True -1
True True
native -> stat True -1
True True
For nltk the test name.split('.')[0] in INVALID_MODULES is False, but
should be True. Why could that be?
- I had to type this 7 times! the google groups message composer is not
very stable :(
On Monday, January 14, 2013 12:38:43 PM UTC+1, Alan Etkin wrote:
>
> The problem is this code in custom_import.py
>
>
> With a very similar configuration but the trunk version I could not
> reproduce the problem (altough the nltk library has taken about 20 seconds
> to import in the model)
>
> My system config:
> Python 2.7.3 Ubuntu 12.04 Rocket server
>
> This has something to do with virtualenv surely. BTW, there's a recent
> issue posted about module headers that might be related.
>
>
--