Agile_Data_Code
Agile_Data_Code copied to clipboard
Timeout exeption message while running gmail.py
Hello, I have a problem when I execute the gmail.py script (ch03/gmail/gmail.py): the email collection does not occur and the "Timeout exception occured!" message is displayed (tested on Mac OS X 10.6 and Linux Debian in a virtual machine running Windows).
Note that the timeout error is displayed even when running the script without specifying any parameters (to display the usage message). Jean-Baptiste
I'm also seeing this.
I'm wondering whether plaintext authentication (self.imap.login(username, password)
in gmail_slurper.py
) no longer works for Gmail?
Anyone else having success with this script?
Edit: some notes
Plaintext auth is still allowed, however, I had to pull the self.imap.login()
call out of the try block to see a different exception bubbling up:
imaplib.error: [ALERT] Application-specific password required: http://support.google.com/accounts/bin/answer.py?answer=185833 (Failure)
It's probaby worth noting that users will have to create an application-specific password if they have 2-factor auth turned on, either in the help text for the command or in errata?
That said, this sleuthing doesn't seem to have eliminated the Timeout exception or allowed me to download my gmail.
I have the same issue. Even after creating an app-specific password. It seems like the way the TimeoutException class is defined, whenever the gmail_slurper.py file is imported in a script, an error will be raised...
The timeout exception shouldn't stop the script - it merely reconnects. Let me look into this...
On Thu, Feb 6, 2014 at 2:39 PM, Cédric Warny [email protected]:
I have the same issue. Even after creating an app-specific password
Reply to this email directly or view it on GitHubhttps://github.com/rjurney/Agile_Data_Code/issues/21#issuecomment-34383026 .
Russell Jurney twitter.com/rjurney [email protected] datasyndrome.com
Commenting out the following line in gmail_slurper.py solved it for me:
sys.stderr.write("Timeout exception occurred!\n")
Looks like writing a stderr out stops the script.
That can't be the case... are you sure the script is stopping? It is actually normal for the script to throw a timeout exception as soon as it starts. I've never figured out why, but it just keeps going.
On Fri, Feb 7, 2014 at 8:23 AM, Cédric Warny [email protected]:
Commenting out the following line in gmail_slurper.py solved it for me:
sys.stderr.write("Timeout exception occurred!\n")
Looks like writing a stderr out stops the script.
Reply to this email directly or view it on GitHubhttps://github.com/rjurney/Agile_Data_Code/issues/21#issuecomment-34461255 .
Russell Jurney twitter.com/rjurney [email protected] datasyndrome.com
I've successfully run the script.
Just as Russell describes ... I get the timeout exception. The script continues running after displaying message.
Kendall Waters On Feb 7, 2014 9:34 AM, "Russell Jurney" [email protected] wrote:
That can't be the case... are you sure the script is stopping? It is actually normal for the script to throw a timeout exception as soon as it starts. I've never figured out why, but it just keeps going.
On Fri, Feb 7, 2014 at 8:23 AM, Cédric Warny [email protected]:
Commenting out the following line in gmail_slurper.py solved it for me:
sys.stderr.write("Timeout exception occurred!\n")
Looks like writing a stderr out stops the script.
Reply to this email directly or view it on GitHub< https://github.com/rjurney/Agile_Data_Code/issues/21#issuecomment-34461255>
.
Russell Jurney twitter.com/rjurney [email protected] datasyndrome.com
Reply to this email directly or view it on GitHubhttps://github.com/rjurney/Agile_Data_Code/issues/21#issuecomment-34477746 .
I was able to eventually get it to run by commenting out the exception try-catch blocks and fixing whatever Gmail is sending back as an error (first the app-specific password, then something else.)
You might want to try experimenting with that approach as a way to get past it; I understand the reason for the try-catch blocks and don't think the main code needs to change for that since it seems like a subset of users have this problem.
I have/had a similar problem as documented here. As I seldom use my gmail account, I had only 2 emails in the Inbox. The slurper program would only read one and then stop. The output was only a dict definition within the part-1.avro file - no email data was added.
Reading the emails individually, I was able to read the 1st one, but the 2nd one - ID of 2 - returned: "Problem fetching email ID: 2 - CHARSET" and stops.
It appeared that I had weird/corrupted 2nd email (or something) which I deleted and then composed another to myself. This enabled the slurper to add the 1st email to the avro file, but not the 2nd.
I then composed a 3rd email to myself. The slurper added the first 2 emails to the avro file, but not the 3rd. It seems to be losing the last email i.e. prematurely exiting.
At all times, the slurper counts the total number of emails correctly in the ongoing output to the screen.
changing lines 83 and 84 to:
if hasattr(signal, 'SIGALRM'):
signal.signal(signal.SIGALRM, timeout_handler)
if hasattr(signal, 'alarm'):
signal.alarm(30) # triger alarm in 30 seconds
# from
signal.signal(signal.SIGALRM, timeout_handler)
signal.alarm(30) # triger alarm in 30 seconds
in gmail_slurpy.py works for me on my windows machine.
the signal object does not have the attributes sigalrm nor alarm
Can you please send a pull request, and I'll merge it? ᐧ
On Wed, Aug 13, 2014 at 3:29 AM, Basil Muhammad [email protected] wrote:
changing lines 83 and 84 to:
if hasattr(signal, 'SIGALRM'): signal.signal(signal.SIGALRM, timeout_handler) if hasattr(signal, 'alarm'): signal.alarm(30) # triger alarm in 30 seconds# fromsignal.signal(signal.SIGALRM, timeout_handler)signal.alarm(30) # triger alarm in 30 seconds
in gmail_slurpy.py works for me on my windows machine.
the signal object does not have the attributes sigalrm nor alarm
— Reply to this email directly or view it on GitHub https://github.com/rjurney/Agile_Data_Code/issues/21#issuecomment-52032230 .
Russell Jurney twitter.com/rjurney [email protected] datasyndrome.com