Question

When trying to use pydoc under Windows and python.org 2.6.4 I get the following error:

C:\>pydoc sys
'import site' failed; use -v for traceback
Traceback (most recent call last):
  File "C:\programs\Python26\Lib\pydoc.py", line 55, in ?
    import sys, imp, os, re, types, inspect, __builtin__, pkgutil
  File "C:\programs\Python26\Lib\os.py", line 758
    bs = b""
           ^
SyntaxError: invalid syntax

What could be wrong here?

Was it helpful?

Solution

Typical windows problem: I had a program installed lately which brought its own Python 2.4. This installation overwrote the Windows file handlers for python scripts, but did not appear on the PATH. So scripts started from the console ran in the old-version python, but calling "python" ran the 2.6 version.

Thx to Nadia for the first hint.

OTHER TIPS

how about setting your PATH

c:\> set PATH=C:\Python26\Lib;%PATH%
c:\> pydoc.py sys
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top