[1.1.4] running plain Jython from commandline: import problems --- fixed 2019-03-25 build#257

Bug #1821530 reported by nemka on 2019-03-24
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Sikuli
Critical
RaiMan

Bug Description

********************** problem
using:
import org.sikuli.script.SikulixForJython
from sikuli import *
import whatever

leads to:
    import whatever
File "C:\Users\rmhde\AppData\Roaming\Sikulix\Lib\sikuli\SikuliImporter.py", line 50, in find_module module_path = JH.get().findModule(module_name, package_path, sys.path) at java.io.File.<init>(Unknown Source) at org.sikuli.basics.FileManager.normalizeAbsolute(FileManager.java:889) at org.sikuli.script.ImagePath.setBundlePath(ImagePath.java:556) at org.sikuli.script.ImagePath.getBundlePath(ImagePath.java:590) at org.sikuli.script.runnerHelpers.JythonHelper.findModule(JythonHelper.java:530) at sun.reflect.GeneratedMethodAccessor10.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) java.lang.NullPointerException: java.lang.NullPointerException
---------------------------------------------------------------------------------

I've used the latest sikulixapi.jar and got:

Python 2.7.0 (default:9987c746f838, Apr 29 2015, 02:25:11)
[Java HotSpot(TM) 64-Bit Server VM (Oracle Corporation)] on java1.8.0_201
Traceback (most recent call last):
  File ".\test.py", line 44, in <module>
    download(url=installer_url)
  File ".\test.py", line 31, in download
    r = requests.get(url, stream=True)
  File "D:\Users\user\jython27\Lib\site-packages\requests\api.py", line 75, in get
    return request('get', url, params=params, **kwargs)
  File "D:\Users\user\jython27\Lib\site-packages\requests\api.py", line 60, in request
    return session.request(method=method, url=url, **kwargs)
  File "D:\Users\user\jython27\Lib\site-packages\requests\sessions.py", line 519, in request
    prep = self.prepare_request(req)
  File "D:\Users\user\jython27\Lib\site-packages\requests\sessions.py", line 449, in prepare_request
    auth = get_netrc_auth(request.url)
  File "D:\Users\user\jython27\Lib\site-packages\requests\utils.py", line 172, in get_netrc_auth
    from netrc import netrc, NetrcParseError
  File "D:\Users\user\jython27\Lib\site-packages\requests\utils.py", line 172, in get_netrc_auth
    from netrc import netrc, NetrcParseError
  File "D:\Users\user\AppData\Roaming\Sikulix\Lib\sikuli\SikuliImporter.py", line 50, in find_module
    module_path = JH.get().findModule(module_name, package_path, sys.path)
        at java.io.File.<init>(Unknown Source)
        at org.sikuli.basics.FileManager.normalizeAbsolute(FileManager.java:889)
        at org.sikuli.script.ImagePath.setBundlePath(ImagePath.java:556)
        at org.sikuli.script.ImagePath.getBundlePath(ImagePath.java:590)
        at org.sikuli.script.runnerHelpers.JythonHelper.findModule(JythonHelper.java:530)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
        at java.lang.reflect.Method.invoke(Unknown Source)

I do not get this with an older version.

What exactly is your runtime setup?

You seem to work with Jython and sikulixapi.jar on classpath.

Changed in sikuli:
status: New → Opinion
importance: Undecided → Medium
assignee: nobody → RaiMan (raimund-hocke)
milestone: none → 1.1.4
summary: - module not found with latest sikulixapi.jar
+ [1.1.4] module not found with latest sikulixapi.jar
Download full text (3.3 KiB)

Hi,

You are correct, worth mentioning that I am on Windows 10 and hence am
using powershell as admin to run the script.

I think the issue is with
from sikuli import *
and not with the import of the requests package.

On Sun, Mar 24, 2019, 18:55 RaiMan <<email address hidden> wrote:

> What exactly is your runtime setup?
>
> You seem to work with Jython and sikulixapi.jar on classpath.
>
>
> ** Changed in: sikuli
> Status: New => Opinion
>
> ** Changed in: sikuli
> Importance: Undecided => Medium
>
> ** Changed in: sikuli
> Assignee: (unassigned) => RaiMan (raimund-hocke)
>
> ** Changed in: sikuli
> Milestone: None => 1.1.4
>
> ** Summary changed:
>
> - module not found with latest sikulixapi.jar
> + [1.1.4] module not found with latest sikulixapi.jar
>
> --
> You received this bug notification because you are subscribed to the bug
> report.
> https://bugs.launchpad.net/bugs/1821530
>
> Title:
> [1.1.4] module not found with latest sikulixapi.jar
>
> Status in Sikuli:
> Opinion
>
> Bug description:
> I've used the latest sikulixapi.jar and got:
>
>
> Python 2.7.0 (default:9987c746f838, Apr 29 2015, 02:25:11)
> [Java HotSpot(TM) 64-Bit Server VM (Oracle Corporation)] on java1.8.0_201
> Traceback (most recent call last):
> File ".\test.py", line 44, in <module>
> download(url=installer_url)
> File ".\test.py", line 31, in download
> r = requests.get(url, stream=True)
> File "D:\Users\user\jython27\Lib\site-packages\requests\api.py", line
> 75, in get
> return request('get', url, params=params, **kwargs)
> File "D:\Users\user\jython27\Lib\site-packages\requests\api.py", line
> 60, in request
> return session.request(method=method, url=url, **kwargs)
> File "D:\Users\user\jython27\Lib\site-packages\requests\sessions.py",
> line 519, in request
> prep = self.prepare_request(req)
> File "D:\Users\user\jython27\Lib\site-packages\requests\sessions.py",
> line 449, in prepare_request
> auth = get_netrc_auth(request.url)
> File "D:\Users\user\jython27\Lib\site-packages\requests\utils.py",
> line 172, in get_netrc_auth
> from netrc import netrc, NetrcParseError
> File "D:\Users\user\jython27\Lib\site-packages\requests\utils.py",
> line 172, in get_netrc_auth
> from netrc import netrc, NetrcParseError
> File
> "D:\Users\user\AppData\Roaming\Sikulix\Lib\sikuli\SikuliImporter.py", line
> 50, in find_module
> module_path = JH.get().findModule(module_name, package_path,
> sys.path)
> at java.io.File.<init>(Unknown Source)
> at
> org.sikuli.basics.FileManager.normalizeAbsolute(FileManager.java:889)
> at org.sikuli.script.ImagePath.setBundlePath(ImagePath.java:556)
> at org.sikuli.script.ImagePath.getBundlePath(ImagePath.java:590)
> at
> org.sikuli.script.runnerHelpers.JythonHelper.findModule(JythonHelper.java:530)
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
> at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown
> Source)
> at java.lang.reflect.Method.invoke(Unknow...

Read more...

how do you run the script?

run timme setup? Jython, SikuliX, ...

1. Installed jython
2. Installed requests
3. Installed python
4. Downloaded sikulixapi.jar
5. Set CLASSPATH env to sikulixapi.jar
6. Set PATH to python and jython
7. Powershell as admin
8. In powershell:
Jython .\test.py

In test.py:
import org.sikuli.script.SikulixForJython
from sikuli import *
Import requests

Then in the script I use requests.get(url, stream=True)

On Sun, Mar 24, 2019, 19:55 RaiMan <<email address hidden> wrote:

> how do you run the script?
>
> run timme setup? Jython, SikuliX, ...
>
> --
> You received this bug notification because you are subscribed to the bug
> report.
> https://bugs.launchpad.net/bugs/1821530
>
> Title:
> [1.1.4] module not found with latest sikulixapi.jar
>
> Status in Sikuli:
> Opinion
>
> Bug description:
> I've used the latest sikulixapi.jar and got:
>
>
> Python 2.7.0 (default:9987c746f838, Apr 29 2015, 02:25:11)
> [Java HotSpot(TM) 64-Bit Server VM (Oracle Corporation)] on java1.8.0_201
> Traceback (most recent call last):
> File ".\test.py", line 44, in <module>
> download(url=installer_url)
> File ".\test.py", line 31, in download
> r = requests.get(url, stream=True)
> File "D:\Users\user\jython27\Lib\site-packages\requests\api.py", line
> 75, in get
> return request('get', url, params=params, **kwargs)
> File "D:\Users\user\jython27\Lib\site-packages\requests\api.py", line
> 60, in request
> return session.request(method=method, url=url, **kwargs)
> File "D:\Users\user\jython27\Lib\site-packages\requests\sessions.py",
> line 519, in request
> prep = self.prepare_request(req)
> File "D:\Users\user\jython27\Lib\site-packages\requests\sessions.py",
> line 449, in prepare_request
> auth = get_netrc_auth(request.url)
> File "D:\Users\user\jython27\Lib\site-packages\requests\utils.py",
> line 172, in get_netrc_auth
> from netrc import netrc, NetrcParseError
> File "D:\Users\user\jython27\Lib\site-packages\requests\utils.py",
> line 172, in get_netrc_auth
> from netrc import netrc, NetrcParseError
> File
> "D:\Users\user\AppData\Roaming\Sikulix\Lib\sikuli\SikuliImporter.py", line
> 50, in find_module
> module_path = JH.get().findModule(module_name, package_path,
> sys.path)
> at java.io.File.<init>(Unknown Source)
> at
> org.sikuli.basics.FileManager.normalizeAbsolute(FileManager.java:889)
> at org.sikuli.script.ImagePath.setBundlePath(ImagePath.java:556)
> at org.sikuli.script.ImagePath.getBundlePath(ImagePath.java:590)
> at
> org.sikuli.script.runnerHelpers.JythonHelper.findModule(JythonHelper.java:530)
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
> at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown
> Source)
> at java.lang.reflect.Method.invoke(Unknown Source)
>
> I do not get this with an older version.
>
> To manage notifications about this bug go to:
> https://bugs.launchpad.net/sikuli/+bug/1821530/+subscriptions
>

RaiMan (raimund-hocke) on 2019-03-25
Changed in sikuli:
status: Opinion → In Progress
summary: - [1.1.4] module not found with latest sikulixapi.jar
+ [1.1.4] running plain Jython from commandline: import problems

yes, a bug with the latest version.

description: updated
RaiMan (raimund-hocke) on 2019-03-25
summary: - [1.1.4] running plain Jython from commandline: import problems
+ [1.1.4] running plain Jython from commandline: import problems --- fixed
+ 2019-03-25 build#257
Changed in sikuli:
status: In Progress → Fix Committed
importance: Medium → Critical
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers