Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ImportError: cannot import name Ghost

Tags:

python

I know there are similar questions, but I could not find a solution for this one. Here is what I have done.

I installed the ghost module using pip. The site-packages/ghost folder has 3 files __init__.py, ghost.py and test.py.

__init__.py has the following content

from ghost import Ghost
from test import GhostTestCase

module suggests the method

from ghost import Ghost

But it throws the following error.

File "<pyshell#3>", line 1, in <module>
    from ghost import ghost
  File "G:\Python33\lib\site-packages\ghost\__init__.py", line 1, in <module>
    from ghost import Ghost
ImportError: cannot import name Ghost

I tried adding the path to PYTHONPATH; it didn't work. I can't figure out why it is happening with a standard module.I am working in python 3.3

like image 977
feminkk Avatar asked Apr 05 '13 16:04

feminkk


2 Answers

With Python 3, try changing that line in __init__.py to

from .ghost import Ghost

to do a package-relative import. If that works, it's a bug in the module and you should report it.

like image 77
nneonneo Avatar answered Nov 07 '22 13:11

nneonneo


What was you pip command line? Should be pip install Ghost.py and not pip install ghost

like image 2
Jimmy Lee Jones Avatar answered Nov 07 '22 13:11

Jimmy Lee Jones