Skip to content
This repository

TypeError: 'NoneType' object is not iterable while trying default sync #2

Closed
davidweterings opened this Issue May 07, 2012 · 10 comments

7 participants

David Weterings Guillaume Aubert Tim Cooper Craig S. Cottingham Maurus Cuelenaere Benedikt
David Weterings
  • What version of Gmvault do you use ?

Gmvault v1.0-beta

  • On what Operating System (Linux flavour, MacOSX, Win7/XP/Vista) ?

Windows 7

  • Type of requests (Bug, documentation issue, features) ?

Bug

  • Explain the request subject (issue details, feature details):

Note I did not install it to default Program Files (I installed it on another hdd). Problem occurs with and without admin privileges.

Tried out the sync using the tutorial on the website (so gmvault sync myemail@gmail.com). After granting access I get an error. This is in gmvault.log:

[2012-05-07 15:05]:CRITICAL:oauth:Oauth will be used for authentication.

[2012-05-07 15:05]:DEBUG:gmvault_utils:no ENV variable $GMVAULT_DIR defined. Set by default $GMVAULT_DIR to $HOME/.gmvault (C:\Users\David/.gmvault)
[2012-05-07 15:05]:CRITICAL:oauth:Use oauth credentials from C:\Users\David/.gmvault/myemail@gmail.com.oauth.
[2012-05-07 15:05]:CRITICAL:oauth:Successfully read oauth credentials.

[2012-05-07 15:05]:CRITICAL:gmv:Connect to Gmail server.
[2012-05-07 15:05]:CRITICAL:gmv:Error 'NoneType' object is not iterable. For more information see log file

[2012-05-07 15:05]:ERROR:gmv:Traceback (most recent call last):
File "gmv_cmd.py", line 471, in run
File "gmv_cmd.py", line 415, in sync
File "gmvault.pyc", line 450, in __init_

File "imap_utils.pyc", line 234, in connect
File "imapclient\imapclient.pyc", line 296, in select_folder
File "imapclient\imapclient.pyc", line 826, in _encode_folder_name
File "imapclient\imap_utf7.pyc", line 37, in encode
TypeError: 'NoneType' object is not iterable

Traceback (most recent call last):
File "gmv_cmd.py", line 471, in run
File "gmv_cmd.py", line 415, in sync
File "gmvault.pyc", line 450, in __init_

File "imap_utils.pyc", line 234, in connect
File "imapclient\imapclient.pyc", line 296, in select_folder
File "imapclient\imapclient.pyc", line 826, in _encode_folder_name
File "imapclient\imap_utf7.pyc", line 37, in encode
TypeError: 'NoneType' object is not iterable

Tim Cooper

I am experiencing the same issue.

What version of Gmvault do you use ?

Gmvault v1.0-beta

On what Operating System (Linux flavour, MacOSX, Win7/XP/Vista) ?

Windows 7 64-bit

Type of requests (Bug, documentation issue, features) ?

Bug

Explain the request subject (issue details, feature details):

When I try to sync after authenticating using gmvault sync <email>, I am getting the error:

Error 'NoneType' object is not iterable. For more information see log file
Craig S. Cottingham

Same issue, same details as above, but with Mac OS X 10.7.3 and the system-provided Python.

Maurus Cuelenaere

Same issue. Solution: set 'Show in IMAP' in Settings->Labels->All Mail on gmail.com

--- gmvault-1.0-beta2/local/lib/python2.7/site-packages/gmv/imap_utils.py   2012-05-07 20:27:15.000000000 +0200
+++ gmavault-1.0-beta/local/lib/python2.7/site-packages/gmv/imap_utils.py   2012-05-07 20:26:43.520216342 +0200
@@ -228,7 +228,10 @@

         #find the all mail folder
         self.find_all_mail_folder()
-        
+
+         if self._all_mail_folder == None
+             raise Exception("Couldn't find 'All Mail' folder! (Check whether 'Show in IMAP' is enabled in Settings->Labels->All Mail)")
+   
         # set to GMAIL_ALL dir by default and in readonly
         if go_to_all_folder:
             self.server.select_folder(self._all_mail_folder, readonly = self.readonly_folder)

Traceback (most recent call last):
  File "/tmp/gmavault-1.0-beta/local/lib/python2.7/site-packages/gmv/gmv_cmd.py", line 471, in run
    self._sync(args, credential)
  File "/tmp/gmavault-1.0-beta/local/lib/python2.7/site-packages/gmv/gmv_cmd.py", line 415, in _sync
    args['email'], credential, read_only_access = True, use_encryption = args['encrypt'])
  File "/tmp/gmavault-1.0-beta/local/lib/python2.7/site-packages/gmv/gmvault.py", line 450, in __init__
    self.src.connect()
  File "/tmp/gmavault-1.0-beta/local/lib/python2.7/site-packages/gmv/imap_utils.py", line 234, in connect
    self.server.select_folder(self._all_mail_folder, readonly = self.readonly_folder)
  File "/tmp/gmavault-1.0-beta/local/lib/python2.7/site-packages/imapclient/imapclient.py", line 296, in select_folder
    typ, data = self._imap.select(self._encode_folder_name(folder), readonly)
  File "/tmp/gmavault-1.0-beta/local/lib/python2.7/site-packages/imapclient/imapclient.py", line 826, in _encode_folder_name
    name = imap_utf7.encode(name)
  File "/tmp/gmavault-1.0-beta/local/lib/python2.7/site-packages/imapclient/imap_utf7.py", line 37, in encode
    for c in s:
TypeError: 'NoneType' object is not iterable
mcuelenaere@hp4530s:/tmp/gmavault-1.0-beta/bin$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 12.04 LTS
Release:    12.04
Codename:   precise
mcuelenaere@hp4530s:/tmp/gmavault-1.0-beta/bin$ ./python --version
Python 2.7.3
Maurus Cuelenaere

Looks like there already is a similar check, so the following patch is probably better:

--- imap_utils.py.or    2012-05-07 20:48:52.000000000 +0200
+++ imap_utils.py   2012-05-07 20:49:12.000000000 +0200
@@ -269,7 +269,7 @@
                 self._all_mail_folder = GIMAPFetcher.GOOGLE_MAIL_ALL
                 break

-        if the_dir == None:
+        if self._all_mail_folder == None:
             #Error
             raise Exception("Cannot find global dir %s or %s. Are you sure it is a GMail account" % \
                             (GIMAPFetcher.GMAIL_ALL, GIMAPFetcher.GOOGLE_MAIL_ALL))

Craig S. Cottingham

Workaround works for me. Thanks, @mcuelenaere.

Nyr commented May 07, 2012

Same here, probably because I have "Important" label hidden.

The fix should be implemented for all the labels.

Guillaume Aubert
Owner
gaubert commented May 08, 2012

Thanks for the reporting. I fixed the issue with @mcuelenaere suggestion. It will appear in the next version (1.5-beta) that should be release within the next 2 weeks.
I will update the documentation also to indicate that All Mail needs to be visible.

Guillaume Aubert gaubert closed this May 08, 2012
Guillaume Aubert
Owner
gaubert commented May 08, 2012

Fixed and Closed

Benedikt

I don't know if my case is going to be covered with your fix, but I use the localized Gmail, and because of that the IMAP-folders are also translated, so my "All Mail" is also translated, so I get the error even if my localized "All Mail" is checked as visible because I have no folder exactly called "All Mail" (I assume).

Guillaume Aubert
Owner
gaubert commented May 08, 2012

@nudelfabrik Thanks for the comment: The localize issue is also being corrected. It should not be a problem in the next version.
See Issue #5 if you want more info

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.