Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Python

Bummer: twitter.MessageTooLongError: Oh no! Your message was too long (Hello, World!)

Please help me get through this external function challenge with Python! I feel like I'm raising the exception correctly. Now it's just throwing me an assertion error. See below:

try:
tweet(message) raise MessageTooLongError('Oh no! Your message was too long ({})'.format(message)) except CommunicationError as err: print('An error occurred attempting to connect to Twitter. Please try again!')

3 Answers

here is what I used

except MessageTooLongError as err:
    print("Oh no! your message was too long {}".format(err))

Thanks, Ryan! I was able to figure it out. My syntax was correct; however, I was inserting the original message by using "format(message)" instead of "format(err)". Appreciate your help!

Did you use Except before the MessageTooLongError ?

Hey Ryan. I tried using except instead of raise, but it also threw me an error when I subbed in the except keyword. Thoughts?

If you could add a link to the challenge we can give you examples of what to do, to do this when you click the get help button there's a link to "How to ask better questions" . It will show you how to do this