Hi All,
I'm playing with request but running into an issue with chardet.detect call.
def detect(aBuf):
if ((version_info < (3, 0) and isinstance(aBuf, unicode)) or
(version_info >= (3, 0) and not isinstance(aBuf, bytes))):
raise ValueError('Expected a bytes object, not a unicode object')
from . import universaldetector
u = universaldetector.UniversalDetector()
u.reset()
u.feed(aBuf)
u.close()
return u.result
It always throws ValueError exception 'Expected a bytes object, not a unicode
object'. The problem is the isinstance(aBuff,unicode) which returns True for
IronPython and not CPython. I guess in IronPython strings are both a str and
unicode types
>>> v = 'value'
>>> isinstance(v,unicode)
True
>>> isinstance(v,str)
True
I was wondering if this is expected behavior for IronPython? At the moment I
just removed this check in my local copy so I get pass this issue with
requests.
Thanks.
_______________________________________________
Ironpython-users mailing list
[email protected]
https://mail.python.org/mailman/listinfo/ironpython-users