GOVCERT-LU/eml_parser

Cannot use eml-parser

VitarWapeul opened this issue · 4 comments

I have a problem to use library eml-parser

My environment is like this

Use WSL in window(ubuntu 18.04)

Use python 3.7 and 3.6

Use Jupyter notebook

in the jupyter those error messages are came out

-> module 'eml_parser' has no attribute 'EmlParser'

when i using code like this(here is my code)

import datetime
import json
import eml_parser

def json_serial(obj):
if isinstance(obj, datetime.datetime):
serial = obj.isoformat()
return serial

with open('YourECG.eml', 'rb') as fhdl:
raw_email = fhdl.read()

ep = eml_parser.EmlParser()
parsed_eml = ep.decode_email_bytes(raw_email)

print(json.dumps(parsed_eml, default=json_serial))

Thank you, a lot!

Can you verify that you are using the latest version (1.14.3) ?
Also note that the latest version requires python >=3.7

It happens the same way when I using python version 3.7.9, eml-parser version 1.14.3...

It happens the same way when I using python version 3.7.9, eml-parser version 1.14.3...

Could you please paste the output of:

  • python -V
  • pip list

?

The following is what fails for you, but it definitely should not:

Python 3.7.7 (default, May 29 2020, 13:51:46) 
[GCC 8.4.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import eml_parser
>>> ep = eml_parser.EmlParser()
>>>

The same issue arose on my machine, but after upgrading to python version 3.8.2, the issue is resolved.