sikuli-driver team mailing list archive
-
sikuli-driver team
-
Mailing list archive
-
Message #53748
Re: [Question #687415]: Strange problem or a bug in Sikuli
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 ( <module> ) wait_time_2 = int(wait_time_1)
[error] --- Traceback --- end --------------
Thanks
Mark
The Future Is Certain Give Us Time To Work It Out
________________________________
From: bounces@xxxxxxxxxxxxx <bounces@xxxxxxxxxxxxx> on behalf of RaiMan <question687415@xxxxxxxxxxxxxxxxxxxxx>
Sent: Sunday 22 December 2019 13:38
To: bb4wu@xxxxxxxxxxx <bb4wu@xxxxxxxxxxx>
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.