[2.0.5] Python script containing non-ASCII (code or comment) runs in IDE, but not as exported jar --- fixed in 2.0.6
-------
Python scripts containing non-ASCII characters (in code and/or comments) need as 1st or 2nd line
# code: utf-8
to compile correctly (or any other accepted version of this line) - this one is the shortest
In IDE, when running a script, this and some more code is added to the front of the script.
When exporting to a jar, the pre-compile actions add 2 lines at the top, but not the code-comment. So even if your code has the needed code-comment as 1st or 2nd line, it moves to the 3rd or 4th line and is not accepted.
Since currently compile errors simply skip the script-file without any comment, we have the mentioned situation.
There is no workaround in 2.0.5, but it is fixed in 2.0.6 (a code-comment for utf-8 is added and the addition is only one line).
The jar-export will be enhanced further having more options and be more verbose in case of problems.
-------
Hello,
I had a script that was running ok if launched from the IDe but if, after generating runnable jar, launching it from commandline was failing.
The script is using OCR and the tessedit_
I cut away anything that worked and I got this minimal script that exhibits the problem:
#!/usr/bin/python
# -*- coding: utf-8 -*-
popup("£")
When launched from the IDE the popup shows "£", but the executable generated jar does not contain the script class and so it doesn't works.
i.e. If the pop-up contains something like "x" the executable jar contains these folder and files:
META-INF\
org\
__main__$py.class
__run__$py.class
TestNoCmd$py.class
and works if launched from commandline.
If the popup contains the "£" char the TestNoCmd$py.class file disappears from the jar and with the same commandline it doesn't works.
.... deleted
Question information
- Language:
- English Edit question
- Status:
- Solved
- For:
- SikuliX Edit question
- Assignee:
- No assignee Edit question
- Solved by:
- Matteo Acquarone
- Solved:
- Last query:
- Last reply: