Reputation: 13
from linkedin import linkedin
API_KEY = 'my_key'
API_SECRET = 'my_secret'
RETURN_URL = 'http://127.0.0.1:8000'
authentication = linkedin.LinkedInAuthentication(API_KEY, API_SECRET, RETURN_URL, linkedin.PERMISSIONS.enums.values())
print authentication.authorization_url # open this url on your browser
application = linkedin.LinkedInApplication(authentication)
I have got this error:
C:\Python27\python.exe C:/Users/alemcluster.ALEM/PycharmProjects/linkedinapi/linkedin.py
Traceback (most recent call last):
File "C:/Users/alemcluster.ALEM/PycharmProjects/linkedinapi/linkedin.py", line 1, in <module>
from linkedin import linkedin
File "C:\Users\alemcluster.ALEM\PycharmProjects\linkedinapi\linkedin.py", line 1, in <module>
from linkedin import linkedin
ImportError: cannot import name linkedin
Process finished with exit code 1
I tried to change linkedin to another variable, but does not help. I'm sorry if it is not properly posted. Prior to this, I only looked answers to questions.
Upvotes: 1
Views: 2631
Reputation: 140
I faced the same issue. Initially I used pip3 install python-linkedin When I googled this issue, I saw that it works only for python2 but
I later tried
pip3 install python3-linkedin
Now import statement works fine for me. Restart IDE and try... Hope that helps
If you installed linkedin
, and/or python3-linkedin
, you will want to first uninstall both packages and re-install python3-linkedin
afterwards to ensure things work.
Upvotes: 1
Reputation: 653
I have got similar issue a while back. This is due to because your filename is also same as your library name and python interpreter first looks library in a working directory. And when interpreter checks working directory interpreter founds a same name as library name so interpreter start getting from it which is actually not library. That's why it is giving error.
Simple rename your file and you are good to go.
Hope It Works :)
Upvotes: 3