Installing module: import error "No module named 'new'"

Tim Peters tim.one at home.com
Sun Aug 5 18:32:47 EDT 2001


[Sheila King, on Python 2.0, both Windows and Linux]
> ...
> How should I proceed at this point? Why isn't the "new" module available
> to me???

It's unclear whether you had problems importing "new" on both platforms or
only one.  "new" has long been enabled in the Windows Python distribution,
and became enabled by *default* for other distributions beginning in 1.6.
Whoever built your Linux version may have disabled it.  If you can't import
"new" in Windows Python 2.0, something is seriously wrong.

Here's 2.0.1 Windows Python run with the -v switch:

C:\Python20>python -v
# C:\PYTHON20\lib\site.pyc matches C:\PYTHON20\lib\site.py
import site # precompiled from C:\PYTHON20\lib\site.pyc
# C:\PYTHON20\lib\os.pyc matches C:\PYTHON20\lib\os.py
import os # precompiled from C:\PYTHON20\lib\os.pyc
import nt # builtin
# C:\PYTHON20\lib\ntpath.pyc matches C:\PYTHON20\lib\ntpath.py
import ntpath # precompiled from C:\PYTHON20\lib\ntpath.pyc
# C:\PYTHON20\lib\stat.pyc matches C:\PYTHON20\lib\stat.py
import stat # precompiled from C:\PYTHON20\lib\stat.pyc
# C:\PYTHON20\lib\UserDict.pyc matches C:\PYTHON20\lib\UserDict.py
import UserDict # precompiled from C:\PYTHON20\lib\UserDict.pyc
Python 2.0.1 (#18, Jun 22 2001, 02:26:03) [MSC 32 bit (Intel)] on win32
Type "copyright", "credits" or "license" for more information.
>>> import new
import new # builtin
>>>

As it says at the end, "new" is a builtin module (just like, e.g., "math"
and "cPickle" in this respect -- there is no separate file enabling it, it's
built in to the interpreter).





More information about the Python-list mailing list