Issue2590
Created on 2017-05-08.11:13:35 by BjarkeBB, last changed 2017-05-19.03:01:30 by zyasoft.
File name |
Uploaded |
Description |
Edit |
Remove |
rc.log
|
BjarkeBB,
2017-05-08.11:13:35
|
|
|
|
msg11363 (view) |
Author: Bjarke B. Blendstrup (BjarkeBB) |
Date: 2017-05-08.11:17:23 |
|
I'm trying to use the carreralib
https://pypi.python.org/pypi/carreralib/0.2.0
When I execute the connection from python, it works:
[root@CLOUDCITY ~]# python
Python 2.7.10 (default, Jun 20 2016, 14:45:40)
[GCC 5.3.1 20160406 (Red Hat 5.3.1-6)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> from carreralib import ControlUnit
>>> cu = ControlUnit('FF:B8:21:1D:DF:7F')
>>> cu.request()
Status(fuel=(0, 0, 0, 0, 0, 0, 0, 0), start=0, mode=2, pit=(False, False, False, False, False, False, False, False), display=8)
But when I try to do the same via Jython, I get the attached exception from the ControlUnit constructor.
My java code:
PythonInterpreter python = new PythonInterpreter();
// http://stackoverflow.com/questions/14754402/jython-importerror-no-module-named
python.exec("import sys");
python.exec("sys.path.append('/usr/lib/python2.7/')");
python.exec("sys.path.append('/usr/lib/python2.7/site-packages/')");
python.exec("from carreralib import ControlUnit");
python.exec("cu = ControlUnit('FF:B8:21:1D:DF:7F')");
My project is a spring-boot project, and I use the mvn package:
<dependency>
<groupId>org.python</groupId>
<artifactId>jython-standalone</artifactId>
<version>2.7.1b2</version>
</dependency>
|
msg11364 (view) |
Author: Jim Baker (zyasoft) |
Date: 2017-05-08.16:34:05 |
|
Ordinary files, as wrapped by org.python.core.io.StreamIO, cannot be selected on in Jython, only sockets; see https://github.com/jimbaker/socket-reboot#selectable-files (including possible future directions).
But the exception thrown should be better. Most likely we can follow whatever is done with respect to CPython on Windows, which has a similar restriction.
|
msg11365 (view) |
Author: Bjarke B. Blendstrup (BjarkeBB) |
Date: 2017-05-08.17:07:14 |
|
AFAIK it's trying to open a BlueTooth connection - is that not a socket?
But then again, I might not know what I'm talking about...
|
msg11383 (view) |
Author: Jim Baker (zyasoft) |
Date: 2017-05-19.03:01:30 |
|
It is a socket, but I don't know if there's good Java support for such sockets. Maybe we could http://netty.io/wiki/native-transports.html to support AF_BLUETOOTH?
|
|
Date |
User |
Action |
Args |
2017-05-19 03:01:30 | zyasoft | set | messages:
+ msg11383 |
2017-05-08 17:07:14 | BjarkeBB | set | messages:
+ msg11365 |
2017-05-08 16:34:06 | zyasoft | set | nosy:
+ zyasoft messages:
+ msg11364 |
2017-05-08 11:17:24 | BjarkeBB | set | messages:
+ msg11363 |
2017-05-08 11:13:35 | BjarkeBB | create | |
|