'Twython' from partially initialized module 'twython' (most likely due to a circular import) #536

Open
opened 2020-07-10 20:01:43 -07:00 by NilSagor · 2 comments
NilSagor commented 2020-07-10 20:01:43 -07:00 (Migrated from github.com)

python 3.8.2
twython 3.8.2

ImportError: cannot import name 'Twython' from partially initialized module 'twython' (most likely due to a circular import)

import sys
import string
from twython import Twython

twitter = Twython('Insert Consumer Key Here',
'Insert Consumer Secret Key',oauth_version=2)
Access_token = twitter.obtain_access_token()
t = Twython('Insert Consumer Key', access_token=Access_token)

user_timeline = t.search(q='@puremichigan', count=20, include_rts=1)

for tweets in user_timeline['statuses']:
print(tweets['text'] +"\n")

python 3.8.2 twython 3.8.2 ImportError: cannot import name 'Twython' from partially initialized module 'twython' (most likely due to a circular import) import sys import string from twython import Twython twitter = Twython('Insert Consumer Key Here', 'Insert Consumer Secret Key',oauth_version=2) Access_token = twitter.obtain_access_token() t = Twython('Insert Consumer Key', access_token=Access_token) user_timeline = t.search(q='@puremichigan', count=20, include_rts=1) for tweets in user_timeline['statuses']: print(tweets['text'] +"\n")
gangaasoonu commented 2023-12-02 06:56:57 -08:00 (Migrated from github.com)

Same .. Wondering how to solve.

Same .. Wondering how to solve.
gangaasoonu commented 2023-12-02 10:13:20 -08:00 (Migrated from github.com)

Found the solution:

python file/script name was same as the Library
viz., twython.py

Python Interpreter got confused.

renaming the python script name to something else (viz., call_twython.py) solved this Issue.

Found the solution: python file/script name was same as the Library viz., twython.py Python Interpreter got confused. renaming the python script name to something else (viz., call_twython.py) solved this Issue.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: code/twython#536
No description provided.