Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TypeError: initial_value must be str or None, not bytes #15

Open
mrhyde opened this issue Mar 11, 2018 · 2 comments
Open

TypeError: initial_value must be str or None, not bytes #15

mrhyde opened this issue Mar 11, 2018 · 2 comments

Comments

@mrhyde
Copy link

mrhyde commented Mar 11, 2018

Despite the declared python3 support, I was unable to run it on Ubuntu 17.10

  File "imapbox.py", line 97, in <module>
    main()
  File "imapbox.py", line 90, in main
    stats = mailbox.copy_emails(options['days'], options['local_folder'], options['wkhtmltopdf'])
  File "/home/imapbox/mailboxresource.py", line 39, in copy_emails
    if self.saveEmail(data):
  File "/home/imapbox/mailboxresource.py", line 72, in saveEmail
    msg = email.message_from_string(response_part[1])
  File "/usr/lib/python3.6/email/__init__.py", line 38, in message_from_string
    return Parser(*args, **kws).parsestr(s)
  File "/usr/lib/python3.6/email/parser.py", line 68, in parsestr
    return self.parse(StringIO(text), headersonly=headersonly)
TypeError: initial_value must be str or None, not bytes

trying the same code with python2.7 leads to the desired result but from time to time this kind of error is popping out:

/mnt/volume-fra1-01/arc/2017/3128654e-fa30-40e8-823a-e6e745c7c350KAWGMEHUB01.gme.gbl
MailboxClient.saveEmail() failed
'ascii' codec can't decode byte 0xe2 in position 0: ordinal not in range(128)

which is probably related to default encoding in python2

I would gladly contribute with a PR but unfortunately, python is not my forte :(

@polo2ro
Copy link
Owner

polo2ro commented Mar 18, 2018

Hi, when the PR with python3 support has been merged, i created a python2 branch. for python2 support, you must use that branch. P3 version is actually not production ready, i just pushed today a major fix for this on master branch

@mrhyde
Copy link
Author

mrhyde commented Mar 18, 2018

Great! Thank you for information and your great work. I will give it a try and let you know about the result

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants