altaurog/pgcopy

ImportError: cannot import name CopyManager

ramthakur1991 opened this issue · 3 comments

Hi,

I am using the pgcopy module with python 2.7 and install it via using following command i.e
pip install pgcopy

System setups:-
OS:- Ubuntu 14.04
Python version: 2.7.6
virtualenv: virtualenv
RAM: 16GB

When I try to run the provided example I am getting the above error each and every time.

Traceback (most recent call last):
  File "bulk.py", line 2, in <module>
    from pgcopy import CopyManager
  File "/var/www/ansible-platform/python-bulk-insert/pgcopy.py", line 7, in <module>
    from pgcopy import CopyManager
ImportError: cannot import name CopyManager

I am also attaching a sample python script which I am using to run it under the isolated environment.
Python script

Please let know I am doing any mistake.

Looking forward your response
Thanks

It looks like you might have more than one pgcopy in your python path. In particular, this looks a bit suspicious: "/var/www/ansible-platform/python-bulk-insert/pgcopy.py". There is no pgcopy.py in pgcopy. If you installed into a virtualenv, it would show up in a directory <virtualenv-path>/lib/python2.7/site-packages/pgcopy/

HI @altaurog ,
Thanks for your suggestion.

Actually I realize that I did a silly mistake. I have a one more python file on root directory with the name of pgcopy.py.

That's the reason Python throws the error ImportError: cannot import name CopyManager. Because that file doesn't contains the CopyManager method.

Thanks for your suggestion.

Glad I could help and thanks for reporting back @ramthakur1991.