firecat53 / urlscan

Mutt and terminal url selector (similar to urlview)
GNU General Public License v2.0
214 stars 38 forks source link

AttributeError: 'list' object has no attribute 'encode' #19

Closed svenXY closed 9 years ago

svenXY commented 9 years ago

Hi,

I have a different problem with a multipart mail, the problem only occurs within mutt, not after saving the whole multipart message, and not after only saving the html and txt parts.

I'm not sure how to give you some test code now, I'm afraid.

The error was:

Traceback (most recent call last):
  File "/usr/lib/python3.4/email/message.py", line 357, in set_charset
    cte(self)
TypeError: 'str' object is not callable

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/bin/urlscan", line 118, in process_input
    msg.set_charset(c)
  File "/usr/lib/python3.4/email/message.py", line 365, in set_charset
    payload = payload.encode('ascii', 'surrogateescape')
AttributeError: 'list' object has no attribute 'encode'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/lib/python3.4/email/message.py", line 357, in set_charset
    cte(self)
TypeError: 'str' object is not callable

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/bin/urlscan", line 127, in <module>
    msg = process_input(args.message)
  File "/usr/bin/urlscan", line 121, in process_input
    i.set_charset(c)
  File "/usr/lib/python3.4/email/message.py", line 365, in set_charset
    payload = payload.encode('ascii', 'surrogateescape')
AttributeError: 'list' object has no attribute 'encode'

I'll try to bounce you the message, but please keep it confidential.

svenXY commented 9 years ago

The mails's subject is 'Docker meetup'

firecat53 commented 9 years ago

I'm not seeing this error with the email you sent. Just to check -- you are using the 'master' branch, correct? What exact version of python and urwid are you using? It looks like (according to mutt) the message still came through as a multipart message. I'll try to test some more later. Can you find any other multipart messages that fail for you?

Edit (after some much needed sleep...): disregard about using the 'master' git branch. I see that you are...

firecat53 commented 9 years ago

Can you find the text copy of the original message, put it in a tar archive for safekeeping and send me that? I wonder if mutt rewrote the file somehow when you bounced it to me. I think I know what's going on, but I need something to test :)

firecat53 commented 9 years ago

I pushed a possible fix to the 'parts' branch. Please test and see if that solves the issue for you.

svenXY commented 9 years ago

Hi Scott,

you're making good progress. I'm now getting the URLs displayed correctly, but also get some errors shown like:

Unable to decode message:
b'[...] Stra\xdfe [...] URL> [3]\n\n\n\n\n\n'
'utf-8' codec can't decode byte 0xdf in position 257: invalid continuation byte

it should be the german 'ß' as in Straße

Sven

PS: please do not send mails to Stephan, the guy whose mail I bounced to you.

firecat53 commented 9 years ago

My apologies for the email... I wasn't paying attention and thought I was sending it to you!

Can you please tell me what versions of python and urwid you are using. Also, sending the original copy of that email file in a tar archive would be useful because I'm having trouble reproducing the errors.

firecat53 commented 9 years ago

Try updating the 'parts' branch and checking that email again. I may have fixed it, but if it still doesn't work, please send me the info I requested in my previous post.

Thanks! Scott

Edit: Actually -- can you just go ahead and test the 'mailto' branch? It contains these fixes + some other improvements in mailto handling. Thanks!

svenXY commented 9 years ago

Nope, the error remains, unfortunately, also with the mailto branch.

Python 3.4.2 (default, Oct  8 2014, 13:44:52) 
[GCC 4.9.1 20140903 (prerelease)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import urwid
>>> print(urwid.__version__)
1.2.1

I'll see what I can do with the mail

svenXY commented 9 years ago

You got mail :)

firecat53 commented 9 years ago

I think I got it this time :) Try the 'mailto' branch again.

svenXY commented 9 years ago

Yep, perfect. Now all decoding errors are gone for me.

Thanks for the fix.

Sven