Getting errors from Imaplib

Chris Angelico rosuav at gmail.com
Sun Nov 30 13:02:40 CET 2014


On Sun, Nov 30, 2014 at 7:36 PM, Beatrix Willius from Moth Software
<mail at beatrixwillius.de> wrote:
>
> Let's say I have the following very simple Python code:
>
> import imaplib
>
> host = 'imap.gmail.com'
> try:
>     imap_connection = imaplib.IMAP4(host)
>     print('success')
> except imaplib.IMAP4.error:
>     print('authentication failed')
>
> OSError: [Errno 65] No route to host

You're getting an error before it even gets as far as authenticating -
there's a network-level issue here. Are you able to ping that host?
Something's not connected.

ChrisA



More information about the Python-list mailing list