Frage

I am having a very odd problem with Python. Whenever I try to use the built-in help function, I get this error:

    Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib/python2.7/site.py", line 468, in __call__
    import pydoc
  File "/usr/lib/python2.7/pydoc.py", line 56, in <module>
    from repr import Repr
  File "repr.py", line 21
    def 
       ^
SyntaxError: invalid syntax

I have manually inspected the aforementioned files, but I don't see the error mentioned. I also tried deleting the .pyc files for the files mentioned in the trceback in the /usr/share/python2.7 directory, but I am still having the issue.

My computer is running Ubuntu 12.10 64 bit.

War es hilfreich?

Lösung

Do you have a file called repr.py in the current directory? That file is incomplete, and shadows the standard library repr module. You can see from the traceback that the file has no full path, only a local path. Rename it or remove it.

Please, do not just delete .pyc files from your system folders, please reinstall python from packages (using your package manager).

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top