2
from ghost import Ghost

running it from IDLE works; but if I run a py file with only this line of code it get this error.

Traceback (most recent call last):
  File "C:\Users\Teo1\Desktop\sub\ghost.py", line 1, in <module>
    from ghost import Ghost
  File "C:\Users\Teo1\Desktop\sub\ghost.py", line 1, in <module>
    from ghost import Ghost
ImportError: cannot import name Ghost

It may seem a stupid question, but what it's so simple that I can't find my error.

I'm using ghost.py with PySide, both installed with pip.

matteo_c
  • 1,990
  • 2
  • 10
  • 20

1 Answers1

0

Your program is trying to import itself, since the first module ghost it finds is your ghost.py.

Renaming your program will fix this problem.

wizzwizz4
  • 6,140
  • 2
  • 26
  • 62