oliver006 / elasticsearch-gmail

Index your Gmail Inbox with Elasticsearch

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

AttributeError: module 'mailbox' has no attribute 'UnixMailbox'

TMorville opened this issue · comments

When running the code out of the box (all dependencies are imported and work alright) I get:

raceback (most recent call last):
  File "index_emails.py", line 220, in <module>
    IOLoop.instance().run_sync(load_from_file)
  File "/anaconda3/envs/elasticsearch_gmail/lib/python3.6/site-packages/tornado/ioloop.py", line 458, in run_sync
    return future_cell[0].result()
  File "/anaconda3/envs/elasticsearch_gmail/lib/python3.6/site-packages/tornado/concurrent.py", line 238, in result
    raise_exc_info(self._exc_info)
  File "<string>", line 4, in raise_exc_info
  File "/anaconda3/envs/elasticsearch_gmail/lib/python3.6/site-packages/tornado/ioloop.py", line 436, in run
    result = func()
  File "index_emails.py", line 169, in load_from_file
    mbox = mailbox.UnixMailbox(open(tornado.options.options.infile, 'rb'), email.message_from_file)
AttributeError: module 'mailbox' has no attribute 'UnixMailbox'
Exception ignored in: <bound method HTTPClient.__del__ of <tornado.httpclient.HTTPClient object at 0x10dfaf518>>
Traceback (most recent call last):
  File "/anaconda3/envs/elasticsearch_gmail/lib/python3.6/site-packages/tornado/httpclient.py", line 82, in __del__
  File "/anaconda3/envs/elasticsearch_gmail/lib/python3.6/site-packages/tornado/httpclient.py", line 87, in close
  File "/anaconda3/envs/elasticsearch_gmail/lib/python3.6/site-packages/tornado/simple_httpclient.py", line 118, in close
  File "/anaconda3/envs/elasticsearch_gmail/lib/python3.6/site-packages/tornado/httpclient.py", line 203, in close
RuntimeError: inconsistent AsyncHTTPClient cache

Python 3.5.6

Solved by running on Python 2.7. Perhaps that should be added to the README.md.

As Python 2.x is not supported after Jan 2020, the above issue can be resolved by replacing the UnixMailbox with a subclass of Mailbox called mbox .