[IronPython] Id: 356 unicode throws when creating a Unicode string from an invalid Unicode string (was Re: Importing embedded .py files)

Dino Viehland dinov at exchange.microsoft.com
Wed Jul 5 09:45:32 PDT 2006


Ahh, excellent!   I hadn't seen this mail yet when I wrote my other one, and this is exactly what I wanted to see (the call to str).

The only fix I can see for this at this time is supporting 2 different constructors for str & unicode, one which will throw if the conversion fails, and one which won't.


-----Original Message-----
From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of JoeSox
Sent: Tuesday, July 04, 2006 10:53 AM
To: Discussion of IronPython
Subject: [IronPython] Id: 356 unicode throws when creating a Unicode string from an invalid Unicode string (was Re: Importing embedded .py files)

On 7/4/06, Fuzzyman <fuzzyman at voidspace.org.uk> wrote:
> Hmmm... well here is the source code for the Python array module. I'm
> not sure it will help much though.
>
> http://svn.python.org/view/python/trunk/Modules/arraymodule.c?&view=ma
> rkup

Ah, it looks like this specific error is known
http://www.codeplex.com/WorkItem/View.aspx?ProjectName=IronPython&WorkItemId=356
http://lists.ironpython.com/pipermail/users-ironpython.com/2006-May/002235.html

I'm not sure how to workaround this one yet and it looks like I will be waiting for 1.0rc.
Here is my stack if anyone is interested. [I have some comments next to some tracelines that explain what it should be doing]:

Traceback (most recent call last):
File , line 0, in <stdin>##70
File E:\CNUDB.py, line 24, in __init__
[self.nltools = CNUTools.ConceptNetNLTools(self)] File E:\CNUTools.py, line 13, in __init__ [self.m = CNUMontylingua.MontyLingua()] File E:\CNUMontylingua.py, line 15, in __init__ [self.theMontyLemmatiser = MontyLemmatiser.MontyLemmatiser()]
File E:\CNUMontyTagger.py, line 15, in __init__ [self.theLexicon=CNUMontyLexiconFast.MontyLexiconFast()]
File E:\CNUMontyLexiconFast.py, line 37, in __init__ [self.load_fastlexicon()] (found .MDF file "FASTLEXICON") File E:\CNUMontyLexiconFast.py, line 101, in load_fastlexicon [line1=self.array_fromfile(res_arr,self.word_start_arr,built_in_p,self.java_p,java_code='ws')]
                 *
res_arr = "<open file './montylingua/FASTLEXICON_3.MDF', mode 'rb' at 0x00EA...
                 *
self.word_start_arr = <huge array 0xc32bc0>
                 *
built_in_p = 260759
                 *                                                  line1 = None
File CNUMontyLexiconFast, line unknown, in array_fromfile       ?
File E:\CNUMontyLexiconFast.py, line 254, in array_fromfile [array_ptr.fromfile(file_ptr,length)]  file_ptr = "<open file './montylingua/FASTLEXICON_3.MDF', mode 'rb' at 0x00C9...
File E:\array.py, line 209, in fromfile
[self.fromstring(item)]
File E:\array.py, line 222, in fromstring                       [s = str(s)]
File mscorlib, line unknown, in GetString File mscorlib, line unknown, in GetString File mscorlib, line unknown, in CreateStringFromEncoding File mscorlib, line unknown, in GetCharCount File mscorlib, line unknown, in InternalFallback File mscorlib, line unknown, in Fallback File mscorlib, line unknown, in Throw
UnicodeDecodeError: Unable to translate bytes [81] at index 0 from specified cod e page to Unicode.

--
Later, Joe
_______________________________________________
users mailing list
users at lists.ironpython.com
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com


More information about the users mailing list