Re: [Sikuli-driver] [Question #687415]: Strange problem or a bug in Sikuli

2019-12-23 Thread RaiMan
Question #687415 on Sikuli changed:
https://answers.launchpad.net/sikuli/+question/687415

Status: Open => Answered

RaiMan proposed the following answer:
Please go to the Launchpad site and answer/comment directly in the thread.
Answering to the notification emails directly adds clutter to this thread and 
makes it hard to follow.

the problem
[error] Error caused by: java.lang.IllegalArgumentException: Cannot create 
PyString with non-byte value

comes from the Java level and means, that you have some illegal content
at the script level, where a string is expected (as Manfred already
mentioned).

Such problems can only be tracked down in the IDE, by testing suspicious
snippets isolated in a new tab or by only running a line selection
(right mouse on line number column).

add a print statement like print "** testing" and with each test
iteration move it further to get nearer to the crash point.

Another option always is to track back, what has been changed before.

-- 
You received this question notification because your team Sikuli Drivers
is an answer contact for Sikuli.

___
Mailing list: https://launchpad.net/~sikuli-driver
Post to : sikuli-driver@lists.launchpad.net
Unsubscribe : https://launchpad.net/~sikuli-driver
More help   : https://help.launchpad.net/ListHelp


Re: [Sikuli-driver] [Question #687415]: Strange problem or a bug in Sikuli

2019-12-23 Thread Mark McGuinn
Question #687415 on Sikuli changed:
https://answers.launchpad.net/sikuli/+question/687415

Status: Needs information => Open

Mark McGuinn gave more information on the question:
Hi Manfred

   thanks for the followup. The exception is raised when the ide does a
check before executing the code therefore there is no print output just
the error message.

regards
Mark



The Future Is Certain Give Us Time To Work It Out

From: boun...@canonical.com  on behalf of Manfred Hampl 

Sent: Monday 23 December 2019 07:44
To: bb...@hotmail.com 
Subject: Re: [Question #687415]: Strange problem or a bug in Sikuli

Your question #687415 on Sikuli changed:
https://answers.launchpad.net/sikuli/+question/687415

Status: Open => Needs information

Manfred Hampl requested more information:
What is the last output before that error message?

I assume it should be the output of
print("Time Left i...",time_left_i)​

--
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/687415

You received this question notification because you asked the question.

-- 
You received this question notification because your team Sikuli Drivers
is an answer contact for Sikuli.

___
Mailing list: https://launchpad.net/~sikuli-driver
Post to : sikuli-driver@lists.launchpad.net
Unsubscribe : https://launchpad.net/~sikuli-driver
More help   : https://help.launchpad.net/ListHelp


Re: [Sikuli-driver] [Question #687415]: Strange problem or a bug in Sikuli

2019-12-22 Thread Manfred Hampl
Question #687415 on Sikuli changed:
https://answers.launchpad.net/sikuli/+question/687415

Status: Open => Needs information

Manfred Hampl requested more information:
What is the last output before that error message?

I assume it should be the output of
print("Time Left i...",time_left_i)​

-- 
You received this question notification because your team Sikuli Drivers
is an answer contact for Sikuli.

___
Mailing list: https://launchpad.net/~sikuli-driver
Post to : sikuli-driver@lists.launchpad.net
Unsubscribe : https://launchpad.net/~sikuli-driver
More help   : https://help.launchpad.net/ListHelp


Re: [Sikuli-driver] [Question #687415]: Strange problem or a bug in Sikuli

2019-12-22 Thread Mark McGuinn
Question #687415 on Sikuli changed:
https://answers.launchpad.net/sikuli/+question/687415

Status: Answered => Open

Mark McGuinn is still having a problem:
Manfred,

   thanks for the suggestion, unfortunately it is causing an exception
when I try to implement it:


[error] script [ auction_control ] stopped with error at line --unknown--
[error] Error caused by: java.lang.IllegalArgumentException: Cannot create 
PyString with non-byte value

I had a look for the error and there is a suggestion that this is a
problem in jython. I am also still wondering why the correct code is
returned when the int() function is not used, but when it is there  a
problem shows up even when the screen is exactly the same.

regards
Mark


The Future Is Certain Give Us Time To Work It Out

From: boun...@canonical.com  on behalf of Manfred Hampl 

Sent: Sunday 22 December 2019 18:04
To: bb...@hotmail.com 
Subject: Re: [Question #687415]: Strange problem or a bug in Sikuli

Your question #687415 on Sikuli changed:
https://answers.launchpad.net/sikuli/+question/687415

Status: Open => Answered

Manfred Hampl proposed the following answer:
"ValueError ( invalid literal for int() with base 10: '' )​"

This indicates that the value that you wanted to convert was the empty
string which cannot be converted into a number.

My guess:
The screen shows something unexpected - not "PLETE", not "SOON", but also not a 
number, or the OCR program could not correctly interpret the text on the screen

Possible workaround:
In addition the the if-s for "PLETE" and "SOON" add also a branch for the case 
that time_left_i[0] is the empty string after the re.sub action.

maybe something like
…
elif time_left_i[0] == "":​
 print("Empty string")​
 break​
…

--
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/687415/+confirm?answer_id=3

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/687415

You received this question notification because you asked the question.

-- 
You received this question notification because your team Sikuli Drivers
is an answer contact for Sikuli.

___
Mailing list: https://launchpad.net/~sikuli-driver
Post to : sikuli-driver@lists.launchpad.net
Unsubscribe : https://launchpad.net/~sikuli-driver
More help   : https://help.launchpad.net/ListHelp


Re: [Sikuli-driver] [Question #687415]: Strange problem or a bug in Sikuli

2019-12-22 Thread Manfred Hampl
Question #687415 on Sikuli changed:
https://answers.launchpad.net/sikuli/+question/687415

Status: Open => Answered

Manfred Hampl proposed the following answer:
"ValueError ( invalid literal for int() with base 10: '' )​"

This indicates that the value that you wanted to convert was the empty
string which cannot be converted into a number.

My guess:
The screen shows something unexpected - not "PLETE", not "SOON", but also not a 
number, or the OCR program could not correctly interpret the text on the screen

Possible workaround:
In addition the the if-s for "PLETE" and "SOON" add also a branch for the case 
that time_left_i[0] is the empty string after the re.sub action.

maybe something like
…
elif time_left_i[0] == "":​
 print("Empty string")​
 break​
…

-- 
You received this question notification because your team Sikuli Drivers
is an answer contact for Sikuli.

___
Mailing list: https://launchpad.net/~sikuli-driver
Post to : sikuli-driver@lists.launchpad.net
Unsubscribe : https://launchpad.net/~sikuli-driver
More help   : https://help.launchpad.net/ListHelp


Re: [Sikuli-driver] [Question #687415]: Strange problem or a bug in Sikuli

2019-12-22 Thread Mark McGuinn
Question #687415 on Sikuli changed:
https://answers.launchpad.net/sikuli/+question/687415

Status: Answered => Open

Mark McGuinn is still having a problem:
Hi RaiMan,

   many thanks for the response,i t has helped me to move things
forward. However there is still a problem which is difficult for me as a
newbie to sikuli and python to understand. Using the function you
provided I get back as string containing the time left, which is fine.
The problem arises when I try to convert the string to an int, I get the
situation where the string being returned doesn't contain a string with
a number instead it returns a string which is linked to the auction but
does not appear on the screen. Below is the code:

time_left_i = get_time_left(Region(260,692,89,29))
print("Time Left i...",time_left_i)​
if time_left_i[0] == "PLETE":​
print("Auction Over")​
break​
elif time_left_i[0] == "SOON":​
make_bid(max_bid)​
else:​
wait_time_1 =  re.sub("[^0-9]","",time_left_i[0]) ​
print("Wait time 1 is ",wait_time_1)​
print("The type of wait_time_ is:",type(wait_time_1))​
#wait_time_2 = int(wait_time_1)​
result = isinstance(wait_time_1, str)​
print(wait_time_1,'instance of string?', result)​
​
wait_time_2 = wait_time_1 * 60​
print("Wait time 3 is ",wait_time_2)​
   # wait_time = wait_time_1 - 5​
print("Else")​
#

This invalid string causes  an exception in the ide. It therefore
appears that the int() function is interfering with the reg.text call.
Is this possible?

Error caused by int()
[error] script [ auction_control ] stopped with error in line 95
[error] ValueError ( invalid literal for int() with base 10: '' )​
[error] --- Traceback --- error source first​
line: module ( function ) statement ​
95: main (   ) wait_time_2 = int(wait_time_1)​
[error] --- Traceback --- end --


Thanks
Mark


The Future Is Certain Give Us Time To Work It Out

From: boun...@canonical.com  on behalf of RaiMan 

Sent: Sunday 22 December 2019 13:38
To: bb...@hotmail.com 
Subject: Re: [Question #687415]: Strange problem or a bug in Sikuli

Your question #687415 on Sikuli changed:
https://answers.launchpad.net/sikuli/+question/687415

Status: Open => Answered

RaiMan proposed the following answer:
--- The names used in this piece of code are unique and only used in
these few lines

not really true: time_left_i

Surely not a SikuliX problem, but a coding flaw.

Make a new def: (I prefer camelCase over camel_case)

def getTimeLeft(reg):
return reg.text().split(" ")

and use this one:
time_left_i = getTimeLeft(Region(260,692,89,29))
print ("Time left i = ",time_left_i)

or completely get rid of the def:
time_left_i = Region(260,692,89,29).text().split(" ")
print ("Time left i = ",time_left_i)

if either of those works, you have to go back and check your coding.

--
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/687415/+confirm?answer_id=1

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/687415

You received this question notification because you asked the question.

-- 
You received this question notification because your team Sikuli Drivers
is an answer contact for Sikuli.

___
Mailing list: https://launchpad.net/~sikuli-driver
Post to : sikuli-driver@lists.launchpad.net
Unsubscribe : https://launchpad.net/~sikuli-driver
More help   : https://help.launchpad.net/ListHelp


Re: [Sikuli-driver] [Question #687415]: Strange problem or a bug in Sikuli

2019-12-22 Thread RaiMan
Question #687415 on Sikuli changed:
https://answers.launchpad.net/sikuli/+question/687415

Status: Open => Answered

RaiMan proposed the following answer:
--- The names used in this piece of code are unique and only used in
these few lines

not really true: time_left_i

Surely not a SikuliX problem, but a coding flaw.

Make a new def: (I prefer camelCase over camel_case)

def getTimeLeft(reg):
return reg.text().split(" ")

and use this one:
time_left_i = getTimeLeft(Region(260,692,89,29))
print ("Time left i = ",time_left_i)

or completely get rid of the def:
time_left_i = Region(260,692,89,29).text().split(" ")
print ("Time left i = ",time_left_i)

if either of those works, you have to go back and check your coding.

-- 
You received this question notification because your team Sikuli Drivers
is an answer contact for Sikuli.

___
Mailing list: https://launchpad.net/~sikuli-driver
Post to : sikuli-driver@lists.launchpad.net
Unsubscribe : https://launchpad.net/~sikuli-driver
More help   : https://help.launchpad.net/ListHelp


Re: [Sikuli-driver] [Question #687415]: Strange problem or a bug in Sikuli

2019-12-21 Thread Mark McGuinn
Question #687415 on Sikuli changed:
https://answers.launchpad.net/sikuli/+question/687415

Mark McGuinn gave more information on the question:
This is the extracted routine:

def get_time():

time_reg = (Region(260,692,89,29))   
Debug.user("In Timer calculator...")   
time_left_s = time_reg.text()   
Debug.user("time_left_s = "+time_left_s)   
time_left_i = time_left_s.split(" ")

return(time_left_i)

and this is what calls it when it works:
time_left_i = get_time()
print ("Time left i = ",time_left_i)

-- 
You received this question notification because your team Sikuli Drivers
is an answer contact for Sikuli.

___
Mailing list: https://launchpad.net/~sikuli-driver
Post to : sikuli-driver@lists.launchpad.net
Unsubscribe : https://launchpad.net/~sikuli-driver
More help   : https://help.launchpad.net/ListHelp