[Twisted-Python] Twisted throws error for more or less no reason
![](https://secure.gravatar.com/avatar/28047afcce65ab40d417c47c4111e29e.jpg?s=120&d=mm&r=g)
Hi everyone, I hope it is ok when I post the link to stackoverflow, where I already explained the problem. http://stackoverflow.com/questions/25581856/twisted-throws-can-only-pass-thr... I hope someone can help, Best regards Stefan
![](https://secure.gravatar.com/avatar/d57bac257873fa3c0993069a9cde47a5.jpg?s=120&d=mm&r=g)
Am Samstag, 30. August 2014, 21:28:19 schrieb Stefan Hesse:
I hope it is ok when I post the link to stackoverflow, where I already explained the problem.
The source code: if not isinstance(s, str): raise TypeError("Can only pass-through bytes on Python 2") # Ensure we're limited to ASCII subset: s.decode('ascii') You could check if what you get here is not a str but unicode. You could change the error message to include the type and value of s -- Wolfgang
![](https://secure.gravatar.com/avatar/28047afcce65ab40d417c47c4111e29e.jpg?s=120&d=mm&r=g)
Thank you! the problem was caused by an unicode string. Changing this line: | "attachment; filename=\"" + os.path.basename(video['title'] + "." + video['format']) + "\"") to this: || "attachment; filename=\"" + str(os.path.basename(video['title']) + "." + video['format']) + "\"")| fixes it. Thanks again! On 30.08.2014 21:38, Wolfgang Rohdewald wrote:
![](https://secure.gravatar.com/avatar/d57bac257873fa3c0993069a9cde47a5.jpg?s=120&d=mm&r=g)
Am Samstag, 30. August 2014, 21:28:19 schrieb Stefan Hesse:
I hope it is ok when I post the link to stackoverflow, where I already explained the problem.
The source code: if not isinstance(s, str): raise TypeError("Can only pass-through bytes on Python 2") # Ensure we're limited to ASCII subset: s.decode('ascii') You could check if what you get here is not a str but unicode. You could change the error message to include the type and value of s -- Wolfgang
![](https://secure.gravatar.com/avatar/28047afcce65ab40d417c47c4111e29e.jpg?s=120&d=mm&r=g)
Thank you! the problem was caused by an unicode string. Changing this line: | "attachment; filename=\"" + os.path.basename(video['title'] + "." + video['format']) + "\"") to this: || "attachment; filename=\"" + str(os.path.basename(video['title']) + "." + video['format']) + "\"")| fixes it. Thanks again! On 30.08.2014 21:38, Wolfgang Rohdewald wrote:
participants (2)
-
Stefan Hesse
-
Wolfgang Rohdewald