Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot compile Jython because an SyntaxError from sikulixapi.jar #32

Closed
Linkaynn opened this issue Sep 21, 2018 · 2 comments
Closed

Cannot compile Jython because an SyntaxError from sikulixapi.jar #32

Linkaynn opened this issue Sep 21, 2018 · 2 comments
Labels
question Further information is requested

Comments

@Linkaynn
Copy link

Without the API all works, but when I add it to my project as library, a syntax error ocurred.

I'm using JDK8 and Jython 2.7

Output:

Traceback (innermost last):
  (no code object) at line 0
  File "C:\Users\jese5\IdeaProjects\Test\lib\sikulixapi.jar", line 1
	PK��
	  ^
SyntaxError: Lexical error at line 1, column 3.  Encountered: "\u0003" (3), after : ""

Process finished with exit code -1

My code:

class TOC(object):
    def __init__(self):
        print("Hello World")
TOC()

And the libraries:

image

@RaiMan
Copy link
Owner

RaiMan commented Sep 22, 2018

I just tested in my IntelliJ (version 1.1.4):
sikulixapi.jar must be on the Java classpath: the place to add that is in a run config in the Environment variables as CLASSPATH <path-to>sikulixapi.jar (the fat jar from the download page)

Having it anywhere else in the project environment does not help.

In your main script at the beginning add

from org.sikuli.script import SikulixForJython
from sikuli import *

This adds the needed pointers to the Jython runtime environment (sys.path, pre-imports).

Be aware: code completion does not work for the SikuliX features (not available at compile time)

@RaiMan RaiMan added the question Further information is requested label Sep 22, 2018
@Linkaynn
Copy link
Author

Thanks, all resolved 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants