#1
|
|||
|
|||
WaitForStrings TypeError in Python
This is occurring in Python. When trying to use WaitForStrings I keep receiving a TypeError which reads as follows:
Error: an integer is required Line 6My code is as follows: result = int(crt.Screen.WaitForStrings(">","#")) crt.Screen.Send(str(result)) the first line is line 6, the offending line. The error persists if I add a timeout value as well. Does anyone know why this is happening? |
#2
|
|||
|
|||
Clarification, the issue still persists even with the int() removed from the code.
result = crt.Screen.WaitForStrings(">","#") |
#3
|
|||
|
|||
Hi Ginfizz,
Would it be possible for you to provide more of your code? It is difficult to determine what is causing this error based on the small snippet of code that you have provided. If you do not feel comfortable sharing the script here, please send me an email to support@vandyke.com with "ATTN: Brittney, Forum Thread 13523" in the subject line.
__________________
Thanks, --Brittney VanDyke Software Technical Support support@vandyke.com (505) 332-5730 |
#4
|
|||
|
|||
My code is actually just that snippet as I was testing to see what was causing the issue. WaitForStrings works fine in VBS but Python seems to be working differently, though its likely just me not understanding.
Here is the full code. Code:
#$language = "python" #$interface = "1.0" def main(): result = crt.Screen.WaitForStrings(">","#", 5) crt.Screen.Send(result) main() Code:
#$language = "python" #$interface = "1.0" def main(): result = crt.Screen.WaitForStrings(">","#") crt.Screen.Send(result) main() Code:
#$language = "VBScript" #$interface = "1.0" Sub Main result = crt.Screen.WaitForStrings(">","#", 5) crt.Screen.Send(result) End Sub Seems to only be an issue with Python. |
#5
|
|||
|
|||
Here is a screen shot of the error I am receiving.
![]() ![]() As you can see, the same error occurs with and without the variable being assigned. |
#6
|
|||
|
|||
Hi Ginfizz,
In Python, [ ]s are required to designate what strings you would like WaitForStrings to well, wait for. The first argument must either be a single string, or an array of multiple strings. The second argument must be an integer representing the timeout value. For example: Code:
result = crt.Screen.WaitForStrings([">","#"], 5)
__________________
Thanks, --Brittney VanDyke Software Technical Support support@vandyke.com (505) 332-5730 |
#7
|
|||
|
|||
Thanks a ton! This works perfectly, I appreciate the help.
|
![]() |
Tags |
python , typeerror , waitforstrings |
Thread Tools | |
Display Modes | Rate This Thread |
|
|