rgladwell / imap-upload

Python script for uploading a local mbox file to IMAP4 server.
Other
130 stars 30 forks source link

Fix: failing for non-Google Takeout usage #57

Closed rgladwell closed 2 years ago

rgladwell commented 2 years ago

Script fails on line 414 with the error message:

ERROR ('mboxMessage' object has no attribute 'boxes')

This moves broken code into the scope which contains msg.boxes.

Resolves:

https://github.com/rgladwell/imap-upload/issues/56

rgladwell commented 2 years ago

@buganini can you let me know if this resolves your issue?

OriolMari commented 2 years ago

I had the same issue and this change resolves it. One thing I miss in this version is the verbose response with message count and subjects. I suggest a conditional print depending on if you are using Google takeout or not

rgladwell commented 2 years ago

I'll merge this and raise another PR to re-add the verbose responses for non-takeout imports.

rgladwell commented 2 years ago

This is my first attempt at a fix: https://github.com/rgladwell/imap-upload/pull/58

Does it work for you, @OriolMari?

OriolMari commented 2 years ago

Thank you Ricardo,

This is the idea but I found an error on the code. I think that the code from line 415 to 217 should be:

        else:
            print(self.format % \
                (self.count + 1, size, prefix + "B", '{:30.30}'.format(remove_control_chars(sbj))), end=' ')