[IronPython] codecs module in Silverlight

Dino Viehland dinov at microsoft.com
Tue Dec 15 02:05:13 CET 2009


You could do:

import _codecs
def lookup_error(name):
    raise LookupError('unknown error handler')
_codecs.lookup_error = lookup_error


This looks like we've just overly aggressively disabled some functionality
in Silverlight.  Maybe it used to depend upon something that wasn't available
but it doesn't look like it does anymore.  I've opened a bug:

http://ironpython.codeplex.com/WorkItem/View.aspx?WorkItemId=25673

It should be trivial to fix.

> -----Original Message-----
> From: users-bounces at lists.ironpython.com [mailto:users-
> bounces at lists.ironpython.com] On Behalf Of Lukas Cenovsky
> Sent: Monday, December 14, 2009 4:56 PM
> To: Discussion of IronPython
> Subject: [IronPython] codecs module in Silverlight
> 
> Hi all,
> I cannot import codecs module in Silverligh IronPython - it throws
> NameError for lookup_error method. The reason is this method is not in
> the _codecs module of Silverlight IronPython:
> 
> dir(_codecs) - Silverlight
> ['__doc__', '__name__', '__package__', 'ascii_decode', 'ascii_encode',
> 'charbuffer_encode', 'charmap_decode', 'charmap_encode', 'decode', 'encode',
> 'escape_decode', 'escape_encode', 'lookup', 'raw_unicode_escape_decode',
> 'raw_unicode_escape_encode', 'readbuffer_encode', 'register',
> 'unicode_escape_decode', 'unicode_escape_encode', 'unicode_internal_decode',
> 'unicode_internal_encode', 'utf_16_be_decode', 'utf_16_be_encode',
> 'utf_16_decode', 'utf_16_encode', 'utf_16_ex_decode', 'utf_16_le_decode',
> 'utf_16_le_encode', 'utf_8_decode', 'utf_8_encode']
> 
> dir(_codecs) - IronPython
> ['__doc__', '__name__', '__package__', 'ascii_decode', 'ascii_encode',
> 'charbuffer_encode', 'charmap_decode', 'charmap_encode', 'decode', 'encode',
> 'escape_decode', 'escape_encode', 'latin_1_decode', 'latin_1_encode',
> 'lookup',
> 'lookup_error', 'mbcs_decode', 'mbcs_encode', 'raw_unicode_escape_decode',
> 'raw_unicode_escape_encode', 'readbuffer_encode', 'register',
> 'register_error',
> 'unicode_escape_decode', 'unicode_escape_encode', 'unicode_internal_decode',
> 'unicode_internal_encode', 'utf_16_be_decode', 'utf_16_be_encode',
> 'utf_16_decode', 'utf_16_encode', 'utf_16_ex_decode', 'utf_16_le_decode',
> 'utf_16_le_encode', 'utf_32_decode', 'utf_32_encode', 'utf_32_ex_decode',
> 'utf_32_le_decode', 'utf_32_le_encode', 'utf_7_decode', 'utf_7_encode',
> 'utf_8_decode', 'utf_8_encode']
> 
> Any idea how to make it work? Thanks.
> 
> --
> -- Lukáš
> 
> _______________________________________________
> Users mailing list
> Users at lists.ironpython.com
> http://lists.ironpython.com/listinfo.cgi/users-ironpython.com



More information about the Ironpython-users mailing list