You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
""" Convert to unicode, raise exception with instructive error
93
+
message if s is not unicode or ascii. """
94
+
ifnotisinstance(s, unicode):
95
+
ifnotisinstance(s, str):
96
+
raiseTypeError('You are required to pass either unicode or string here, not: %r (%s)'% (type(s), s))
97
+
try:
98
+
s=s.decode('ascii')
99
+
exceptUnicodeDecodeError, le:
100
+
raiseTypeError('You are required to pass either a unicode object or an ascii string here. You passed a Python string object which contained non-ascii: %r. The UnicodeDecodeError that resulted from attempting to interpret it as ascii was: %s'% (s, le,))
0 commit comments