Re: UnicodeDecodeError

Frank Burkhardt <[email protected]> Wed, 7 Dec 2005 16:16:27 +0100
Newsgroups gmane.comp.web.zope.zodb.dirstorage
Message-ID <[email protected]>
Hi,

On Wed, Dec 07, 2005 at 01:23:06PM +0000, Toby Dickenson wrote:
> On Tuesday 06 Dec 2005 14:39, Frank Burkhardt wrote:
> > Hi,
> >
> > I'm using dirstorage with zope3. Sometimes it fails with an error like this
> > one:
> >
> > File "/SCR/zope3-svn/instance/lib/python/DirectoryStorage/Full.py", line
> > 187, in _vote_impl
> > temp=struct.pack("!HHHIH",len(u),len(d),len(e),len(ob),0) + u + d + e + ob
> > UnicodeDecodeError: 'ascii' codec can't decode byte 0x99 in position 5:
> > ordinal not in range(128)
> >
> > What can I do to fix that?
> 
> Im not sure. You may have to do some debugging here.
> 
> 
> One of the variables referenced on that line must be a unicode object.
> 
> 'ob' seems unlikely to be the cause, because it calculated from a list of oids 
> a little earlier. 'e' seems unlikely too, because it is generated by pickling 
> extension data in BaseStorage.py
> 
> 'u' is the user name and 'd' is the transaction description. These seem likely 
> to be the cause. Im not sure exactly where these come from in Zope3, but I am 
> sure they shouldnt be unicode.

I'm not really a python expert. How do I determine, if a variable is unicode or
not? I used the debugger but type(ob,u,...) just told me, that those objects are
of type "str".

What do I do with a variable that is unicode but shouldn't - is there a way to
convert it to ascii?

Regards,

Frank


-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems?  Stop!  Download the new AJAX search engine that makes
searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
http://ads.osdn.com/?ad_id=7637&alloc_id=16865&op=click