[Fedora-suds-list] Invalid token with string, OK as file

Joshua J. Kugler joshua at eeinternet.com
Wed Mar 3 02:39:19 UTC 2010


On Tuesday 02 March 2010, Jeff Ortel elucidated thus:
> "result" is actually a class of type suds.sax.text.Text which is a
> subclass of unicode. Seems that either the StringIO or expat parser
> has a problem unicode.  Probably the StringIO.  The reason it works
> to write to a file and then read it again is that when you read(),

Ah, that make sense.  I wasn't catching on to the fact that it was 
unicode.

> you now have a str object.  When reading directly from a file, the
> parser is reading a file-like object.

Figured it was something like that, but since 'print result' worked, I 
wasn't catching the unicode glitch. :)

> So, this:
>  > print 'From string:', p.parse(string=str(result))
>
> works and this:
>  > print 'From string:', p.parse(string=unicode(result))

Thanks for the work around. That will help!

j

-- 
Joshua Kugler
Part-Time System Admin/Programmer
http://www.eeinternet.com
PGP Key: http://pgp.mit.edu/  ID 0x73B13B6A


More information about the suds mailing list