gbrodman / order-tracking

Automated Amazon and Best Buy order tracking for buying groups
GNU Affero General Public License v3.0
34 stars 13 forks source link

Handle Failure When IMAP Folder Not Present #112

Open neocryptek opened 4 years ago

neocryptek commented 4 years ago

Received this error when running get_tracking_numbers.py

imaplib.error: command SEARCH illegal in state AUTH, only allowed in states SELECTED

Seems to happen when mail folder selection fails per this:

https://stackoverflow.com/questions/39115141/imaplib-error-command-search-illegal-in-state-auth-only-allowed-in-states-sele

Here's where we select the IMAP folder:

mail.select('"[Gmail]/All Mail"')

https://github.com/gbrodman/order-tracking/blob/master/lib/email_tracking_retriever.py#L132

This will fail to select this folder if you have "All Mail" label disabled from IMAP in your GMail settings (like I did). Worked fine on re-run once I re-enabled it.

Script should check if select() succeeds and if not present the user with an error that it can't find the "All Mail" IMAP folder and to check their IMAP settings in GMail. Probably should add this to the IMAP section in the README too.

markspivey commented 3 years ago

I'm also getting the following error message, but I already had the "All Mail" label checked for IMAP under my label settings:

imaplib.error: command SEARCH illegal in state AUTH, only allowed in states SELECTED

Any suggestions would be much appreciated, as this doesn't work for me with either Windows or Mac installations.

markspivey commented 3 years ago

I'm also getting the following error message, but I already had the "All Mail" label checked for IMAP under my label settings:

imaplib.error: command SEARCH illegal in state AUTH, only allowed in states SELECTED

Any suggestions would be much appreciated, as this doesn't work for me with either Windows or Mac installations.

Per current code references it's

mail.select('"[Gmail]/All Mail"')

Or, if you previously created the email account in the UK like I did, it may need to be changed to:

mail.select('"[Google Mail]/All Mail"')

This is because Gmail used to be called Google Mail in the UK due to trademark issues.

mazda341 commented 3 years ago

Recieving an error when sharing google sheet to service account email address. "Delivery to the following recipient failed permanently:"

How do you solve this?

gbrodman commented 3 years ago

@mazda341 that is ignorable, it's just trying to send an email to your service account which fails due to not having email set up

mazda341 commented 3 years ago

When running get_tracking_numbers.py. It reads and uploads some tracking info but on some emails it tries to fetch I recieve following message." Fetching trackings: 100%|█████████████████████████████████████████████████████████████| 1/1 [01:20<00:00, 80.27s/email] Couldn't find full tracking info/matching buying group for some emails." The tracking info from email was available on amazon website but it failed to read it. What can be causing this issue??

markspivey commented 3 years ago

Seems like I've been crippled again by this error. SMH.

markspivey commented 3 years ago

@gbrodman assuming that everyone else is having issues with the following error now:

imaplib.error: command SEARCH illegal in state AUTH, only allowed in states SELECTED

We were able to diagnose the issue. It looks like one of your peers made a slight code change in the naming convention for the "All Mail" IMAP folder, whereby it is now called "All mail" (with lowercase "m"). Therefore, either a (hopefully temporary) update could be pushed, or whoever might be reading this, you need to update the references in the following files to fix:

markspivey commented 3 years ago

@gbrodman assuming that everyone else is having issues with the following error now:

imaplib.error: command SEARCH illegal in state AUTH, only allowed in states SELECTED

We were able to diagnose the issue. It looks like one of your peers made a slight code change in the naming convention for the "All Mail" IMAP folder, whereby it is now called "All mail" (with lowercase "m"). Therefore, either a (hopefully temporary) update could be pushed, or whoever might be reading this, you need to update the references in the following files to fix:

* verify_orders.py

* lib/order_info.py

* lib/cancelled_items_retriever.py

* lib/email_tracking_retriever.py

* lib/group_site_manager.py

I guess Google changed it back. It's been reverted to "All Mail" now.