[Tutor] Re: Import Site Failed Resolution
Kent Johnson
kent37 at tds.net
Tue Jan 25 20:42:09 CET 2005
OK, getting closer. import site is failing because site imports os and that import is failing. The
error message points to a line that should be part of the docstring at the beginning of os.py...strange.
Here are the first 22 lines from my os.py - the entire docstring. If your Python2.4\Lib\os.py
doesn't look like this then you could try pasting in these lines instead, or maybe reinstalling to
make sure nothing else is corrupted...
**** Next line is start of os.py ****
r"""OS routines for Mac, DOS, NT, or Posix depending on what system we're on.
This exports:
- all functions from posix, nt, os2, mac, or ce, e.g. unlink, stat, etc.
- os.path is one of the modules posixpath, ntpath, or macpath
- os.name is 'posix', 'nt', 'os2', 'mac', 'ce' or 'riscos'
- os.curdir is a string representing the current directory ('.' or ':')
- os.pardir is a string representing the parent directory ('..' or '::')
- os.sep is the (or a most common) pathname separator ('/' or ':' or '\\')
- os.extsep is the extension separator ('.' or '/')
- os.altsep is the alternate pathname separator (None or '/')
- os.pathsep is the component separator used in $PATH etc
- os.linesep is the line separator in text files ('\r' or '\n' or '\r\n')
- os.defpath is the default search path for executables
- os.devnull is the file path of the null device ('/dev/null', etc.)
Programs that import and use 'os' stand a better chance of being
portable between different platforms. Of course, they must then
only use functions that are defined by all platforms (e.g., unlink
and opendir), and leave all pathname manipulation to os.path
(e.g., split and join).
"""
**** End of snippet from os.py ****
Kent
jhomme wrote:
> Hi,
> Here is all the information I could get from the display of the output from this error. How do I figure out what is going on and fix the problem? This is on a Windows 2000 machine.
>
> graphic 910 C:\WINNT\system32\command.com
> C:\PYTHON>python -v
> # installing zipimport hook
> import zipimport # builtin
> # installed zipimport hook
> # c:\python24\lib\site.pyc matches c:\python24\lib\site.py
> import site # precompiled from c:\python24\lib\site.pyc
> import os # precompiled from os.pyc
> 'import site' failed; traceback:
> Traceback (most recent call last):
> File "c:\python24\lib\site.py", line 61, in ?
> import os
> File "c:\python24\lib\os.py", line 4, in ?
> - all functions from posix, nt, os2, mac, or ce, e.g. unlink, stat, etc.
> AttributeError: 'module' object has no attribute 'path'
> # c:\python24\lib\warnings.pyc matches c:\python24\lib\warnings.py
> import warnings # precompiled from c:\python24\lib\warnings.pyc
> # c:\python24\lib\types.pyc matches c:\python24\lib\types.py
> import types # precompiled from c:\python24\lib\types.pyc
> # c:\python24\lib\linecache.pyc matches c:\python24\lib\linecache.py
> import linecache # precompiled from c:\python24\lib\linecache.pyc
> import os # precompiled from os.pyc
> Python 2.4 (#60, Nov 30 2004, 11:49:19) [MSC v.1310 32 bit (Intel)] on win32
> Type "help", "copyright", "credits" or "license" for more information.
>
>
> Thanks.
>
> Jim
>
> _______________________________________________
> Tutor maillist - Tutor at python.org
> http://mail.python.org/mailman/listinfo/tutor
>
More information about the Tutor
mailing list