Pastebin
Paste #1555: python traceback
< previous paste - next paste>
Pasted by chrivers
#!/usr/bin/python
#encoding=utf-8
class test(object):
x = u"filename.dat"
def __str__(self):
print "str"
return str(self.x)
def __unicode__(self):
print "unicode"
return unicode(self.x)
t = test()
import os
os.stat(t)
------------------
Traceback (most recent call last):
File "test.py", line 19, in <module>
os.stat(t)
TypeError: coercing to Unicode: need string or buffer, test found
New Paste
Go to most recent paste.