I’m trying to put together an exception for this error.

<class ‘TwitterAPI.TwitterError.TwitterConnectionError’>
(‘Connection broken: IncompleteRead(0 bytes read)’, IncompleteRead(0 bytes read))

I found this example code

http://geduldig.github.io/TwitterAPI/faulttolerance.html

Except when I try it I get the following:

NameError: name ‘TwitterConnectionError’ is not defined

Also, the exception TwitterConnectionError: does not change color in my Python text editor like my other exceptions.

What am I missing? Do I need to import exception from the twitter API or something? If so, how do I do that?

I’m pretty new to Python error handling to this is probably a stupid question so sorry about that

name ‘...’ is not defined

is usually a symptom of not defining a variable, or not importing a module. I think you’re missing:

from TwitterAPI import TwitterConnectionError

1 Like

This solved it!

Thanks for all your help. Thanks to you I’ve got my project in a state that’s working great!

2 Likes

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.