Title: Jython 2.7a2-cannot import name BlockingIOError
Type: behaviour Severity: normal
Components: Library Versions: Jython 2.7
Status: closed Resolution: works for me
Dependencies: Superseder:
Assigned To: Nosy List: jiang_dsa, zyasoft
Priority: Keywords:

Created on 2013-06-06.08:22:44 by jiang_dsa, last changed 2014-05-21.21:42:08 by zyasoft.

File name Uploaded Description Edit Remove
Screenshot-2013-06-06 16:08:51.png jiang_dsa, 2013-06-06.08:22:43
msg8040 (view) Author: yunpeng jiang (jiang_dsa) Date: 2013-06-06.08:22:43
java test code:
import java.util.Properties;

import org.python.core.Py;
import org.python.core.PyString;
import org.python.core.PySystemState;
import org.python.util.PythonInterpreter;

public class Tester {

    public static void main(String[] args) throws IOException {

        Properties props = new Properties();
        Properties baseProps = PySystemState.getBaseProperties();
        props.put("python.path", "/duitang/dist/sys/jython/Lib");
        props.put("python.home", "/duitang/dist/sys/jython");
        PySystemState.initialize(baseProps, props, new String[0]);

        PySystemState sys = new PySystemState();
        PythonInterpreter interp = new PythonInterpreter(Py.newStringMap(), sys);
        String rootPath = "/duitang/dist/app/trunk/java/japa/src/main/webapp";

        sys.path.append(new PyString(rootPath));
        interp.exec("import gzip");

error message:
Exception in thread "main" Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/duitang/dist/sys/jython/Lib/", line 10, in <module>
    import io
  File "/duitang/dist/sys/jython/Lib/", line 63, in <module>
    from _io import (DEFAULT_BUFFER_SIZE, BlockingIOError, UnsupportedOperation,
ImportError: cannot import name BlockingIOError
msg8483 (view) Author: Jim Baker (zyasoft) Date: 2014-05-21.21:42:08
Most likely this is a CLASSPATH issue for the poster of this bug:

$ jython27
Jython 2.7b3+ (default:06161ebf74ee+, May 21 2014, 12:09:01)
[Java HotSpot(TM) 64-Bit Server VM (Oracle Corporation)] on java1.7.0_21
Type "help", "copyright", "credits" or "license" for more information.
>>> from _jyio import BlockingIOError
>>> dir(BlockingIOError)
['__class__', '__delattr__', '__dict__', '__doc__', '__format__', '__getattribute__', '__getitem__', '__getslice__', '__hash__', '__init__', '__module__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__setattr__', '__setstate__', '__slots__', '__str__', '__subclasshook__', '__unicode__', '__weakref__', 'args', 'errno', 'filename', 'message', 'strerror']
Date User Action Args
2014-05-21 21:42:08zyasoftsetstatus: open -> closed
resolution: works for me
messages: + msg8483
nosy: + zyasoft
2013-06-06 08:22:44jiang_dsacreate