View Single Post
Old 10-27-2020, 12:20 PM   #1
JimmXinu
Plugin Developer
JimmXinu ought to be getting tired of karma fortunes by now.JimmXinu ought to be getting tired of karma fortunes by now.JimmXinu ought to be getting tired of karma fortunes by now.JimmXinu ought to be getting tired of karma fortunes by now.JimmXinu ought to be getting tired of karma fortunes by now.JimmXinu ought to be getting tired of karma fortunes by now.JimmXinu ought to be getting tired of karma fortunes by now.JimmXinu ought to be getting tired of karma fortunes by now.JimmXinu ought to be getting tired of karma fortunes by now.JimmXinu ought to be getting tired of karma fortunes by now.JimmXinu ought to be getting tired of karma fortunes by now.
 
JimmXinu's Avatar
 
Posts: 6,999
Karma: 4604635
Join Date: Dec 2011
Location: Midwest USA
Device: Kobo Clara Colour running KOReader
Bundled email package out of date?

I have some code that uses the bundled email package to read an eml file. It works prior to v5, but now fails. Looks like a py3 incompatibility to me. I don't know where that package comes from, otherwise I'd look in more detail.

Code:
import six
import email
...
if f.endswith(".eml"):
    fhandle = six.moves.urllib.request.urlopen(f)
    msg = email.message_from_file(fhandle) # line 206
Error:
Code:
calibre, version 5.3.0
ERROR: Unhandled exception: <b>TypeError</b>:string argument expected, got 'bytes'

calibre 5.3* [64bit]  embedded-python: True is64bit: True
Windows-10-10.0.19041-SP0 Windows ('64bit', 'WindowsPE')
('Windows', '10', '10.0.19041')
Python 3.8.5
Windows: ('10', '10.0.19041', 'SP0', 'Multiprocessor Free')
Interface language: None
Successfully initialized third party plugins: FanFicFare (3, 24, 10) && View Manager (1, 5, 7)
Traceback (most recent call last):
  File "calibre_plugins.fanficfare_plugin.dialogs", line 206, in dropEvent
  File "email\__init__.py", line 54, in message_from_file
  File "email\parser.py", line 56, in parse
  File "email\feedparser.py", line 175, in feed
  File "email\feedparser.py", line 103, in push
TypeError: string argument expected, got 'bytes'
JimmXinu is offline   Reply With Quote