If you look at the Python documentation for os.devnull, it says "New in version 2.4". So Jython 2.2.1 does not support it, but Jython 2.5 does support it:
Jython 2.2.1 on java1.6.0_06
Type "copyright", "credits" or "license" for more information.
>>> import os
>>> os.devnull
Traceback (innermost last):
File "<console>", line 1, in ?
AttributeError: class 'org.python.modules.os' has no attribute 'devnull'
Jython 2.5rc2 (Release_2_5rc2:6341, May 11 2009, 17:07:28)
[Java HotSpot(TM) Client VM (Sun Microsystems Inc.)] on java1.6.0_06
Type "help", "copyright", "credits" or "license" for more information.
>>> import os
>>> os.devnull
'nul'
David H
From: LoD MoD [mailto:lod...@gm...]
Sent: Monday, May 18, 2009 1:39 PM
To: jyt...@li...
Subject: [Jython-users] os.devnull AttributeError
I have imported os, but when I try to access this module method, I get the following error:
>>> os.devnull
Traceback (innermost last):
File "<console>", line 1, in ?
AttributeError: class 'org.python.modules.os' has no attribute 'devnull'
|