Register Guidelines E-Books Today's Posts Search

Go Back   MobileRead Forums > E-Book Software > Calibre > Development

Notices

Reply
 
Thread Tools Search this Thread
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,319
Karma: 3966249
Join Date: Dec 2011
Location: Midwest USA
Device: Kindle Paperwhite(10th)
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
Old 10-27-2020, 01:03 PM   #2
kovidgoyal
creator of calibre
kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.
 
kovidgoyal's Avatar
 
Posts: 43,858
Karma: 22666666
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
its the python standard lib and you need to use message_from_binary_file
kovidgoyal is offline   Reply With Quote
Old 10-27-2020, 01:06 PM   #3
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,319
Karma: 3966249
Join Date: Dec 2011
Location: Midwest USA
Device: Kindle Paperwhite(10th)
Ah. Sorry.

Thanks for the taking the time to point out my mistake.
JimmXinu is offline   Reply With Quote
Reply


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Capture email/share date in column? Allreader Library Management 2 10-02-2019 04:33 AM
Ended Nook HD and Boyue T62 bundled loviedovie Flea Market 4 03-15-2016 10:16 PM
Import module not in bundled Python Toxaris Plugins 11 02-01-2016 01:55 AM
Bundled excerpts - can't buy books ceptimus Sony Reader 5 10-01-2008 03:39 PM


All times are GMT -4. The time now is 08:37 PM.


MobileRead.com is a privately owned, operated and funded community.