davesteele / gnome-gmail

Integrate GMail into the Linux Desktop
https://davesteele.github.io/gnome-gmail/
GNU General Public License v2.0
50 stars 13 forks source link

Send broken with Python 3 #55

Closed scop closed 7 years ago

scop commented 7 years ago

Commit 39abc9f0387d99326ee2cf8240d9b56309677ec6 breaks Python 3, it needs message_text as bytes:

Traceback (most recent call last):
  File "/usr/share/gnome-gmail/gnomegmail.py", line 928, in <module>
    main()
  File "/usr/share/gnome-gmail/gnomegmail.py", line 912, in main
    gmailurl = gm_url.gmail_url(args.send)
  File "/usr/share/gnome-gmail/gnomegmail.py", line 602, in gmail_url
    gmailurl = self.api_gmail_url(send)
  File "/usr/share/gnome-gmail/gnomegmail.py", line 577, in api_gmail_url
    access)
  File "/usr/share/gnome-gmail/gnomegmail.py", line 456, in upload_mail
    urlfp = opener.open(request)
  File "/usr/lib64/python3.5/urllib/request.py", line 464, in open
    req = meth(req)
  File "/usr/lib64/python3.5/urllib/request.py", line 1183, in do_request_
    raise TypeError(msg)
TypeError: POST data should be bytes or an iterable of bytes. It cannot be of type str.
davesteele commented 7 years ago

Is this fixed by #56?

scop commented 7 years ago

No, this breakage occurs in upload_mail, #56 fixes a similar one in send_mail.

davesteele commented 7 years ago

Fixed in 0583033dcbe5af22c590d8271208962c24056590, for release with 2.5.

scop commented 7 years ago

Content-Length should be set based on the encoded message text as well, e.g. as in https://src.fedoraproject.org/rpms/gnome-gmail/blob/master/f/gnome-gmail-2.4-py3-upload.patch

davesteele commented 7 years ago

Applied. Thanks