[2.0.1] IDE: script load: absolute image filenames produce "not found" errors

Asked by Jeff_Vallis

2.0.1-2019-11-22_16:54/Mac10.15.2/Java13(64)13.0.1+9

When I open a script in the IDE I get many Errors regarding ImagePath
e.g.
[error] ImagePath: find: File does not exist: /home/jeff/SikuliScripts_Linux/Code/Data/Images/Ruler.png
[error] ImagePath: find: File does not exist: /home/jeff/SikuliScripts_Linux/Subs/Images/Sikuli.png

There is maybe 40 of these errors listed all to do with where the Images are stored on different machines

Why do I get these
The Code that is causing this is :-
if g_Running_Version == "Mac":
    v_Image = "/Users/Jeff/Documents/Sikuli_Live/SikuliScripts/Vikings/Code/Data/Images_Mac/Ruler.png"
    g_This_Ruler = Pattern(v_Image).similar(.9)
else:
    g_This_Ruler = "/home/jeff/SikuliScripts_Linux/Code/Data/Images/Ruler.png"

The IDE does not know that g_Running_Version = "Mac" on this machine and will not process this line

Question information

Language:
English Edit question
Status:
Answered
For:
SikuliX Edit question
Assignee:
No assignee Edit question
Last query:
Last reply:
Revision history for this message
RaiMan (raimund-hocke) said :
#1

How do you set a value for g_Running_Version?

Revision history for this message
Jeff_Vallis (vallis-pj) said :
#2

Home_Directory = os.environ['HOME']
print "Home_Directory",Home_Directory
if Home_Directory == "/Users/Jeff":
    g_Running_Version = "Mac"

Sent from my iPad

> On Dec 21, 2019, at 10:03 AM, RaiMan <email address hidden> wrote:
>
> Your question #687406 on Sikuli changed:
> https://answers.launchpad.net/sikuli/+question/687406
>
> Status: Open => Needs information
>
> RaiMan requested more information:
> How do you set a value for g_Running_Version?
>
> --
> To answer this request for more information, you can either reply to
> this email or enter your reply at the following page:
> https://answers.launchpad.net/sikuli/+question/687406
>
> You received this question notification because you asked the question.

Revision history for this message
RaiMan (raimund-hocke) said :
#3

If I understand right:
The problem comes up, when running on Mac and
if g_Running_Version == "Mac"

does not end up as True.
So you get your Linux image file names.

So you have to find out, why
g_Running_Version
does not contain "Mac" at this place.

or use
Settings.isMac()
to decide, wether you are on macOS.

Revision history for this message
Jeff_Vallis (vallis-pj) said :
#4

No it’s not when running it’s when you first load the script in the IDE

On Sat, Dec 21, 2019 at 6:42 PM RaiMan <email address hidden>
wrote:

> Your question #687406 on Sikuli changed:
> https://answers.launchpad.net/sikuli/+question/687406
>
> Status: Open => Answered
>
> RaiMan proposed the following answer:
> If I understand right:
> The problem comes up, when running on Mac and
> if g_Running_Version == "Mac"
>
> does not end up as True.
> So you get your Linux image file names.
>
> So you have to find out, why
> g_Running_Version
> does not contain "Mac" at this place.
>
> or use
> Settings.isMac()
> to decide, wether you are on macOS.
>
> --
> If this answers your question, please go to the following page to let us
> know that it is solved:
> https://answers.launchpad.net/sikuli/+question/687406/+confirm?answer_id=2
>
> If you still need help, you can reply to this email or go to the
> following page to enter your feedback:
> https://answers.launchpad.net/sikuli/+question/687406
>
> You received this question notification because you asked the question.
>

Revision history for this message
Jeff_Vallis (vallis-pj) said :
#5

to Clarify
This is a Bug in the IDE

work around
    # do not have a string that contains ".png"
    v_dot = "." ; v_png = "png"
    v_Sikuli_Image = "/home/jeff/SikuliScripts_Linux/Subs/Images/Sikuli"+v_dot+v_png

This is my Guess
When Loading a script in the IDE - the IDE "APPEARS" to looks up all items that end with ".png" and if not found then reports them as a an Error (see below)
It cannot evaluate when loading what it is reading, it can only do this at Runtime
The Items that I have reported as Errors are Either on an If Test that do not execute at Runtime or are not the full path of the image as it is preceded by a string that is not available until Runtime.

========================================
These errors do not effect Runtime
and removal of these from the IDE output is only a
NICE TO HAVE
========================================
I am reporting my Opinions on the new version 2 releases
If my Opinion is just a distraction then please advise
e.g. Another Item I have encountered and re-coded is
        wheel(Location(865, 568), WHEEL_DOWN, 25)
        and
        wheel(Location(865, 568), WHEEL_UP, 25)
        seemed to be reversed between Linux and Imac
========================================

[error] ImagePath: find: not there: Date_Time.png
[error] ImagePath: find: not there: Summary_Quan.png
[error] ImagePath: find: not there: _Quan.png
[error] ImagePath: find: not there: Date_Time.png
[error] ImagePath: find: not there: Consumption_Exceeds.png
[error] ImagePath: find: not there: Summary_Desc.png
[error] ImagePath: find: not there: Summary_Quan.png
[error] ImagePath: find: not there: Summary_Result.png
plus many more

Revision history for this message
RaiMan (raimund-hocke) said :
#6

2FAST4ME --- LOL

--- [error] ImagePath: find: not there:

After having finally understood your problem, I would have suggested, to simply switch off the image display in the IDE for now.

But of course you might change your code in the way, you found out.

I will check and revise the behaviour. Will be available in 2.0.2 (end of next week).

--- mouse wheel
indeed, on Mac in the standard the wheel direction is inverted according to the "natural" behaviour as defined by Mac.
There is an option to change this, if on Mac:
Settings.WheelNatural = False

Revision history for this message
RaiMan (raimund-hocke) said :
#7

After having digged a little deeper, I have decided to make a more general solution.

see the related bug

Can you help with this problem?

Provide an answer of your own, or ask Jeff_Vallis for more information if necessary.

To post a message you must log in.