gmvault
gmvault copied to clipboard
argument of type 'NoneType' is not iterable
Just had a restore die unceremoniously with the following error. Any ideas why?
Pushing email body with id 1352024335700262874.
Pushing email body with id 1352024466852032760.
Pushing email body with id 1352024577942439963.
Pushing email body with id 1352024598839188153.
Pushing email body with id 1352024732717239897.
Error: argument of type 'NoneType' is not iterable.
=== Exception traceback ===
Traceback (most recent call last):
File "/Users/gaubert/Dev/projects/gmvault-1.8.2/build/gmvault/out00-PYZ.pyz/gmv.gmv_cmd", line 750, in run
File "/Users/gaubert/Dev/projects/gmvault-1.8.2/build/gmvault/out00-PYZ.pyz/gmv.gmv_cmd", line 625, in _restore
File "/Users/gaubert/Dev/projects/gmvault-1.8.2/build/gmvault/out00-PYZ.pyz/gmv.gmvault", line 901, in restore
File "/Users/gaubert/Dev/projects/gmvault-1.8.2/build/gmvault/out00-PYZ.pyz/gmv.gmvault", line 1145, in restore_emails
File "/Users/gaubert/Dev/projects/gmvault-1.8.2/build/gmvault/out00-PYZ.pyz/gmv.gmvault", line 84, in handle_restore_imap_error
TypeError: argument of type 'NoneType' is not iterable
=== End of Exception traceback ===
Pushing email body with id 1556066536103519338.
Error: argument of type 'NoneType' is not iterable.
=== Exception traceback ===
Traceback (most recent call last):
File "/Users/gaubert/Dev/projects/gmvault-1.8.2/build/gmvault/out00-PYZ.pyz/gmv.gmv_cmd", line 750, in run
File "/Users/gaubert/Dev/projects/gmvault-1.8.2/build/gmvault/out00-PYZ.pyz/gmv.gmv_cmd", line 625, in _restore
File "/Users/gaubert/Dev/projects/gmvault-1.8.2/build/gmvault/out00-PYZ.pyz/gmv.gmvault", line 901, in restore
File "/Users/gaubert/Dev/projects/gmvault-1.8.2/build/gmvault/out00-PYZ.pyz/gmv.gmvault", line 1145, in restore_emails
File "/Users/gaubert/Dev/projects/gmvault-1.8.2/build/gmvault/out00-PYZ.pyz/gmv.gmvault", line 84, in handle_restore_imap_error
TypeError: argument of type 'NoneType' is not iterable
=== End of Exception traceback ===
I have this issue too.
Pushing email body with id 1466170460221572853. Error: argument of type 'NoneType' is not iterable.
=== Exception traceback === Traceback (most recent call last): File "/Users/gaubert/Dev/projects/gmvault-1.8.2/build/gmvault/out00-PYZ.pyz/gmv.gmv_cmd", line 750, in run File "/Users/gaubert/Dev/projects/gmvault-1.8.2/build/gmvault/out00-PYZ.pyz/gmv.gmv_cmd", line 625, in _restore File "/Users/gaubert/Dev/projects/gmvault-1.8.2/build/gmvault/out00-PYZ.pyz/gmv.gmvault", line 901, in restore File "/Users/gaubert/Dev/projects/gmvault-1.8.2/build/gmvault/out00-PYZ.pyz/gmv.gmvault", line 1145, in restore_emails File "/Users/gaubert/Dev/projects/gmvault-1.8.2/build/gmvault/out00-PYZ.pyz/gmv.gmvault", line 84, in handle_restore_imap_error TypeError: argument of type 'NoneType' is not iterable
=== End of Exception traceback ===
Is there a way to do a custom restore so I can skip this email?
Same problem here
I also have this issue
Have same issue.
Is there any fix for this issue? :(
+1
As stated in #256 and #281 , a fix for this was to be released in an upcoming release of Gmvault (1.9.2). Version 1.9.2 never seems to have gotten past a beta release and was never merged into the main branch. If you need this fix, you can take your chances by installing the beta branch (gmv-1.9.2, located here) or by manually applying the patch itself ( commit 7cf1239f33b75795595ab2a8fe28a400a72cb2d1 ).
FYI, I applied the patch in commit 7cf1239 to my local version and still got the error. While I'm sure some occurrences were mitigated, I don't think this type of problem is completely solved with that change.
I too got this same error message after 2 days of restoring emails using 1.9.1.....
Error: argument of type 'NoneType' is not iterable.
=== Exception traceback === Traceback (most recent call last): File "c:\Users\toto\Dev\gmvault\build\gmv_runner\out00-PYZ.pyz\gmv.gmv_cmd", line 750, in run File "c:\Users\toto\Dev\gmvault\build\gmv_runner\out00-PYZ.pyz\gmv.gmv_cmd", line 625, in _restore File "c:\Users\toto\Dev\gmvault\build\gmv_runner\out00-PYZ.pyz\gmv.gmvault", line 901, in restore File "c:\Users\toto\Dev\gmvault\build\gmv_runner\out00-PYZ.pyz\gmv.gmvault", line 1145, in restore_emails File "c:\Users\toto\Dev\gmvault\build\gmv_runner\out00-PYZ.pyz\gmv.gmvault", line 84, in handle_restore_imap_error TypeError: argument of type 'NoneType' is not iterable
=== End of Exception traceback ===
@aoberoi You're right that the there's something else going on here- I tried the patch and it seemed to work at first, but later the same error recurred (seemingly randomly). How reproducible is this problem for you? If it's consistent, what happens if you add the --debug
flag to the restore command?
I too got this same error message after 2 days of restoring emails using 1.9.1.....
That's interesting, the set of e-mails I was restoring took more than 2 days to restore as well. Could be pure coincidence, but I'll add my data point to this thread on the off-chance that it's related.
Once I had the patch applied, I think it ran continuously for a whole day before it crashed. I can’t be sure because I was away from the machine. The next time I ran the restore I think it ran to completion (but my memory could be off).
I didn’t know about the --debug
flag. I’ll give it a try to see what happens. I don’t think there will as much data for me to download and then restore, so I don’t think we’ll hit the 2 day mark. Might only be 20 minutes worth of data or something.
I was able to get a more relevant stack trace whilst running with --debug
:
Before to Append email contents
Appended data with flags [u'\\Seen'] and internal time 2010-10-21 15:45:46. Operation time = 9.25142979622.
res = None
Catch the following exception argument of type 'NoneType' is not iterable
argument of type 'NoneType' is not iterable
Traceback (most recent call last):
File "/usr/lib/python2.6/site-packages/gmv/gmvault.py", line 1120, in restore_emails
email_meta[self.gstorer.INT_DATE_K] )
File "/usr/lib/python2.6/site-packages/gmv/imap_utils.py", line 132, in wrapper
return the_func(*args, **kwargs)
File "/usr/lib/python2.6/site-packages/gmv/imap_utils.py", line 815, in push_data
if '(Success)' not in res:
TypeError: argument of type 'NoneType' is not iterable
Error: argument of type 'NoneType' is not iterable.
=== Exception traceback ===
Traceback (most recent call last):
File "/usr/lib/python2.6/site-packages/gmv/gmv_cmd.py", line 750, in run
self._restore(args, credential)
File "/usr/lib/python2.6/site-packages/gmv/gmv_cmd.py", line 625, in _restore
emails_only = args['emails_only'], chats_only = args['chats_only'])
File "/usr/lib/python2.6/site-packages/gmv/gmvault.py", line 901, in restore
self.restore_emails(pivot_dir, extra_labels, restart)
File "/usr/lib/python2.6/site-packages/gmv/gmvault.py", line 1147, in restore_emails
handle_restore_imap_error(err, gm_id, db_gmail_ids_info, self)
File "/usr/lib/python2.6/site-packages/gmv/gmvault.py", line 84, in handle_restore_imap_error
raise the_exception
TypeError: argument of type 'NoneType' is not iterable
=== End of Exception traceback ===
No exception seems to be thrown in the try/except block starting here, which leads me to believe that self.server.append is returning the None
that's gumming this up. This method is defined here.
msg_time
is defined ("2010-10-21 15:45:46"), so the if statement at 318 shouldn't be setting time_val to None
either (if that could've caused this?). Might be a bug with the _command_and_check
inherited from IMAPClient. That's about as deep as I'm able to dig right now.
Python 2.6 😱
If you can reliably reproduce this, I’d be interested if it still happens on a supported version of Python (even 2.7 support will end this year).
I was running this on a host using CentOS 6- Python 2.6 will remain the default Python there for quite a bit longer, even if Python 2 support officially ends. At any rate, I gave up and found a workaround for what I was trying to accomplish. Hopefully someone will find a fix for this (and I'll be able to upgrade some hosts to CentOS 7 or even 8 :wink: )
I had a sequence of about 60-70 emails where this happened. I tried the patch from 1.9.2, but it still happened. It looks like this is the key:
File "/usr/lib/python2.6/site-packages/gmv/imap_utils.py", line 815, in push_data if '(Success)' not in res:
res is None by default, so the append function isn't returning anything.
I hacked the error handler to add a case for "TypeError" in handle_restore_imap_error
to quarantine those emails, and there were about 50 or so emails in a sequence that all had this error. After it cleared those 50, restoring continued without an error.
As a workaround, you can "skip" the bad emails by going to your gmvalt-db directory, find the hidden .info folder, edit the [accountname]_email_last_id.restore file to be the number of the bad email. You might have to do this a bunch of times if there are a bunch in a row, but it will let you manually "skip" those bad ones at least.
EDIT: I didn't include a patch for my error handler patch because I could not identify the actual problem, so a patch for that is just a workaround that might actually be "bad" if the error is something else that needs to be fixed
Fixed it! It was a socket timeout issue. gmail sometimes takes a while for APPEND responses.
one line of code patch:
mod_imap.py
line 250, add socket.setdefaulttimeout(70)
before `super(MonkeyIMAPClient, self).init(host, port, use_uid, need_ssl)
socket.setdefaulttimeout(70)
super(MonkeyIMAPClient, self).__init__(host, port, use_uid, need_ssl)
I'm getting the same error and tried applying the timeout suggested (also tried with much larger timeout values) but keep hitting the same error. I'm not confident the timeout is being set, I tried adding a print statement but don't see it.
Am I running it correctly when built from source?
- Clone repo / download zip
- Edit mod_imap.py to add setdefaulttimeout line
- Run
python setup.py install
(I have python 2.7.16) - Run
make
- Unzip
build/gmvault-1.9.1.tar.gz
, e.g.tar -zxvf build/gmvault-1.9.1.tar.gz -C build/
- Run
build/gmvault-1.9.1/etc/scripts/gmvault
with necessary args