The case of the missing modules

Dan Bishop danb_83 at yahoo.com
Sat Jul 26 03:02:40 CEST 2003


I installed Python on the HP 3000 at work today.

The interpreter itself appears to be working fine, but "import math",
"import datetime", etc. fail with "ImportError: No module named
[name]".  (However, os and system can be imported successfully.)

I used help('modules') to print a list of available modules and there
were only 14 (__builtin__, _codecs, _sre, _symtable, errno,
exceptions, gc, imp, marshal,
posix, signal, sys, xxsubtype, zipimport).

Any ideas as to why Python can't find most of its modules?

-------------------------------------------------------------------------------

$ ./python -v
# installing zipimport hook
import zipimport # builtin
# installed zipimport hook
# /tmp/python/Lib/site.pyc matches /tmp/python/Lib/site.py
import site # precompiled from /tmp/python/Lib/site.pyc
# /tmp/python/Lib/os.pyc matches /tmp/python/Lib/os.py
import os # precompiled from /tmp/python/Lib/os.pyc
import posix # builtin
# /tmp/python/Lib/posixpath.pyc matches /tmp/python/Lib/posixpath.py
import posixpath # precompiled from /tmp/python/Lib/posixpath.pyc
# /tmp/python/Lib/stat.pyc matches /tmp/python/Lib/stat.py
import stat # precompiled from /tmp/python/Lib/stat.pyc
# /tmp/python/Lib/copy_reg.pyc matches /tmp/python/Lib/copy_reg.py
import copy_reg # precompiled from /tmp/python/Lib/copy_reg.pyc
# /tmp/python/Lib/types.pyc matches /tmp/python/Lib/types.py
import types # precompiled from /tmp/python/Lib/types.pyc
# /tmp/python/Lib/warnings.pyc matches /tmp/python/Lib/warnings.py
import warnings # precompiled from /tmp/python/Lib/warnings.pyc
# /tmp/python/Lib/linecache.pyc matches /tmp/python/Lib/linecache.py
import linecache # precompiled from /tmp/python/Lib/linecache.pyc
Python 2.3c1 (#9, Aug 13 1970, 13:25:05) 
[GCC 3.2.2] on mpeix70
Type "help", "copyright", "credits" or "license" for more information.
>>> raise SystemExit
# clear __builtin__._
# clear sys.path
# clear sys.argv
# clear sys.ps1
# clear sys.ps2
# clear sys.exitfunc
# clear sys.exc_type
# clear sys.exc_value
# clear sys.exc_traceback
# clear sys.last_type
# clear sys.last_value
# clear sys.last_traceback
# clear sys.path_hooks
# clear sys.path_importer_cache
# clear sys.meta_path
# restore sys.stdin
# restore sys.stdout
# restore sys.stderr
# cleanup __main__
# cleanup[1] zipimport
# cleanup[1] warnings
# cleanup[1] signal
# cleanup[1] site
# cleanup[1] linecache
# cleanup[1] posix
# cleanup[1] types
# cleanup[1] exceptions
# cleanup[2] stat
# cleanup[2] copy_reg
# cleanup[2] posixpath
# cleanup[2] os
# cleanup[2] os.path
# cleanup sys
# cleanup __builtin__
# cleanup ints: 4 unfreed ints in 4 out of 105 blocks
# cleanup floats
$ set | grep "PYTHON"
PYTHONHOME="/tmp/python"
PYTHONPATH="/tmp/python/Lib"




More information about the Python-list mailing list