Message6449

Author hheimbuerger
Recipients hheimbuerger
Date 2011-03-22.16:25:17
SpamBayes Score 3.1427044e-10
Marked as misclassified No
Message-id <1300811118.01.0.127616058444.issue1722@psf.upfronthosting.co.za>
In-reply-to
Content
Tested on Jython 2.5.2. Could not set the version in the issue tracker, because no version has been defined for 2.5.2 final.

I'm trying to use the codecs.open() function with mixed results.

Here's what I get when trying from the Jython REPL:

Jython 2.5.2 (Release_2_5_2:7206, Mar 2 2011, 23:12:06)
[Java HotSpot(TM) Client VM (Sun Microsystems Inc.)] on java1.6.0_23
Type "help", "copyright", "credits" or "license" for more information.
>>> import codecs
>>> import org.python.core.codecs
>>> import _codecs
>>> codecs.open
<function open at 0x2>
>>> org.python.core.codecs.open
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
AttributeError: type object 'org.python.core.codecs' has no attribute 'open'
>>> _codecs.open
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
AttributeError: type object 'org.python.modules._codecs' has no attribute 'open'

So here I can import codecs and get the open function, although it's missing on org.python.modules.codecs. The _codecs was just a try, I couldn't find that anywhere in the documentation. It just helped me in the past with the _collections module.

When trying that in my Jython module embedded into a Java application, I get for codecs:

Traceback (most recent call last):
  File "<iostream>", line 21, in <module>
ImportError: No module named codecs

Both org.python.core.codecs and _codecs I can import, but they are lacking the open() function just as in the Jython REPL.

Traceback (most recent call last):
  File "<iostream>", line 363, in transform
AttributeError: type object 'org.python.core.codecs' has no attribute 'open'
History
Date User Action Args
2011-03-22 16:25:18hheimbuergersetrecipients: + hheimbuerger
2011-03-22 16:25:18hheimbuergersetmessageid: <1300811118.01.0.127616058444.issue1722@psf.upfronthosting.co.za>
2011-03-22 16:25:17hheimbuergerlinkissue1722 messages
2011-03-22 16:25:17hheimbuergercreate