Load Script

Asked by Jeff_Vallis

1.1.0(2015-06-23_01:00nightly)/Mac10.10.4/Java8(64)1.8.0_25-b17
Have read and tried many of the questions and answers but still cannot get the load script to work
Each time I made a change I closed and restarted the IDE.

Script1 tried with and without the ".sikuli extention
from sikuli import *
popup("hello, I am script1")
try:
    if we_are_in_rerun:
        print "Lets see which ",
        reload(script2.sikuli)
        #reload(script2)
        print "In run"
except:
    print "In Exception"
    we_are_in_rerun = True
    import script2.sikuli
    #import script2

Script 2
from sikuli import *
popup("hello, I am script2")
print "hello, I am script2"

Result
popup - hello, I am script1 - Appears

IDE Messages :-
In Exception
[error] script [ Script1 ] stopped with error in line 12
[error] ImportError ( script2.sikuli has no script2.py )

=====================================
I expect its something simple but I am baffled
=====================================

Question information

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

with import and reload() you have to use the script name without the .sikuli

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

see above Script1
tried with and without the ".sikuli extention

see where I have them rem'd out

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

uups, sorry, I have to check during the weekend.

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

already tried with a newer build?

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

1.1.0(2015-06-23_01:00nightly)/Mac10.10.4/Java8(64)1.8.0_25-b17
Was sticking with this as it works fine
( apart from the bug where it loses images - changed preferences to NOT delete images as per your workaround - see I do search the Big/Questions first )

Before I risk a newer build the Error Message :-
[error] ImportError ( script2.sikuli has no script2.py )
Where can I search for this file on a Mac to see if its just a PATH problem

> On 18 Jul 2015, at 11:56:31, RaiMan <email address hidden> wrote:
>
> Your question #269375 on Sikuli changed:
> https://answers.launchpad.net/sikuli/+question/269375
>
> RaiMan requested more information:
> already tried with a newer build?
>
> --
> 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/269375
>
> You received this question notification because you asked the question.

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

just tested on my OS X 10.10.4, Java 8, latest build: no problems

# script1 (main script)
#from sikuli import * # not needed in main script
print "hello, I am script1"
try:
    if we_are_in_rerun:
        print "using reload"
        reload(script2)
except:
    we_are_in_rerun = True
    print "using import"
    import script2

# script2
from sikuli import *
print "hello, I am script2"

both scripts in same folder.

-- 1st run after starting the IDE:
hello, I am script1
using import
hello, I am script2

-- repeating run in same IDE session
hello, I am script1
using reload
hello, I am script2

--- Where can I search for this file on a Mac
the .py file is inside the .sikuli folder, which on Mac is bundle/package.
Finder -> File context menu (right mouse button) -> Show package content

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

I know that U are going to think I am Stupid but I can’t find the Beta Downoad
Found one but am certain that it is not the same as I used before because the Jar created many folders in my Empty Folder whereas the previous created no folders
Previous :-

Download Today :-

> On 19 Jul 2015, at 10:26:30, RaiMan <email address hidden> wrote:
>
> Your question #269375 on Sikuli changed:
> https://answers.launchpad.net/sikuli/+question/269375
>
> Status: Open => Answered
>
> RaiMan proposed the following answer:
> just tested on my OS X 10.10.4, Java 8, latest build: no problems
>
> # script1 (main script)
> #from sikuli import * # not needed in main script
> print "hello, I am script1"
> try:
> if we_are_in_rerun:
> print "using reload"
> reload(script2)
> except:
> we_are_in_rerun = True
> print "using import"
> import script2
>
> # script2
> from sikuli import *
> print "hello, I am script2"
>
> both scripts in same folder.
>
> -- 1st run after starting the IDE:
> hello, I am script1
> using import
> hello, I am script2
>
> -- repeating run in same IDE session
> hello, I am script1
> using reload
> hello, I am script2
>
> --- Where can I search for this file on a Mac
> the .py file is inside the .sikuli folder, which on Mac is bundle/package.
> Finder -> File context menu (right mouse button) -> Show package content
>
> --
> 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/269375/+confirm?answer_id=5
>
> 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/269375
>
> You received this question notification because you asked the question.

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

http://sikulix.com -> nightly button

Be sure to start in an empty folder with setup.

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

Installed latest build
Copied you scripts below :- Same result
IDE

hello, I am script1
using import
[error] script [ Script1 ] stopped with error in line 11
[error] ImportError ( script2.sikuli has no script2.py )

1.1.0(2015-07-21_01:00nightly)/Mac10.10.4/Java8(64)1.8.0_25-b17

Command Line
running SikuliX: /Applications/Sikuli/SikuliX.app/Contents/Java/sikulix.jar -r /Users/Jeff/Desktop/SikuliScripts/Unused/Script1.sikuli
hello, I am script1
using import
[error] script [ /Users/Jeff/Desktop/SikuliScripts/Unused/Script1.sikuli ] stopped with error in line 11
[error] ImportError ( script2.sikuli has no script2.py )

> On 19 Jul 2015, at 10:26:30, RaiMan <email address hidden> wrote:
>
> # script1 (main script)
> #from sikuli import * # not needed in main script
> print "hello, I am script1"
> try:
> if we_are_in_rerun:
> print "using reload"
> reload(script2)
> except:
> we_are_in_rerun = True
> print "using import"
> import script2
>
> # script2
> from sikuli import *
> print "hello, I am script2"

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

only to be sure:
- after setup you moved the newly created SikuliX.app to /Applications ??

you use:
/Users/Jeff/Desktop/SikuliScripts/Unused/Script1.sikuli

... but you say you use my scripts, so it should be

/Users/Jeff/Desktop/SikuliScripts/Unused/script1.sikuli and
/Users/Jeff/Desktop/SikuliScripts/Unused/script2.sikuli

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

Guess there was nothing wrog from the start :-
I was calling script2 and was saving script as Script2 - first letter uppercase

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

shit happens ;-)

be sure, I know that very well with my struggles to make SikuliX better ;-)