Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ImportError: cannot import name ReadTimeout #13

Closed
thermike opened this issue Dec 23, 2015 · 6 comments
Closed

ImportError: cannot import name ReadTimeout #13

thermike opened this issue Dec 23, 2015 · 6 comments

Comments

@thermike
Copy link

Bit of a newb when it comes to Python and can't seem to fix the following error.

Any ideas why I'm unable to run python main.py?

Traceback (most recent call last):
  File "main.py", line 1, in <module>
    from TwitterAPI import TwitterAPI
  File "/usr/local/lib/python2.7/dist-packages/TwitterAPI/TwitterAPI.py", line 9, in <module>
    from requests.exceptions import ConnectionError, ReadTimeout, SSLError
ImportError: cannot import name ReadTimeout
@greg5678
Copy link

sudo pip install --upgrade requests
your welcome

@thermike
Copy link
Author

I'd tried that but the error still occurred.

I was able to fix it with the following, which wraps the exceptions and converts it to a string so that it can be concatenated.

except Exception as e:
                                print("Could not connect to TwitterAPI - are your credentials correct?")
                                print("Exception: " + str(e))

@greg5678
Copy link

check your credentials

On Thu, Apr 21, 2016 at 2:33 PM, thermike notifications@github.com wrote:

I'd tried that but the error still occurred.

I was able to fix it with the following, which wraps the exceptions and
converts it to a string so that it can be concatenated.

except Exception as e:
print("Could not connect to TwitterAPI - are your credentials correct?")
print("Exception: " + str(e))


You are receiving this because you commented.
Reply to this email directly or view it on GitHub
#13 (comment)

@thermike
Copy link
Author

My credentials are definitely correct. I've tested them with the vanilla API Auth test script provided through the TwitterAPI suite and I don't get any errors.

However I get errors with this script, saying creds might be wrong, but if I make the proposed change, then the error is raised but the script continues to run and I see Tweets added to the queue and get retweeted.

@greg5678
Copy link

What os are you running? If you don't mind please run these commands
sudo apt-get update && sudo apt-get upgrade
sudo git clone https://github.com/greg5678/twitter-contest.git
cd twitter-contest
sudo apt-get install python-pip
sudo pip3 install TwitterAPI && sudo pip3 install apscheduler

                            sudo pip3 install setuptools --upgrade

sudo pip3 install --upgrade requests
sudo mv config.json.example config.json
now make the values correspond to your Twitter API credentials
sudo main.py

hope it works now!

@greg5678
Copy link

I made a mistake on the last line. It should be sudo python3 main.py

On Thu, Apr 21, 2016 at 5:23 PM, Greg McSwagger gregmcswagger@gmail.com
wrote:

What os are you running? If you don't mind please run these commands
sudo apt-get update && sudo apt-get upgrade
sudo git clone https://github.com/greg5678/twitter-contest.git
cd twitter-contest
sudo apt-get install python-pip
sudo pip3 install TwitterAPI && sudo pip3 install apscheduler

                              sudo pip3 install setuptools --upgrade

sudo pip3 install --upgrade requests
sudo mv config.json.example config.json
now make the values correspond to your Twitter API credentials
sudo main.py

hope it works now!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants