← Back to team overview

sikuli-driver team mailing list archive

[Question #215388]: Issue with type()

 

New question #215388 on Sikuli:
https://answers.launchpad.net/sikuli/+question/215388

Hi all,

I'm facing an issue when overloading "type" method.

main.py
--------
import MyGeneral
MyGeneral.Type(Key.PAGE_DOWN)

MyGeneral.py
---------------
def Type(TextToType):
	print "MyGeneral.Type - TextToType: "+str(TextToType)
	type(TextToType)


When running main.py, either this following error is raised:
"UnicodeEncodeError: 'ascii' codec can't encode character u'\ue005' in position 0: ordinal not in range(128)"

or I caught this exception if Key.PAGE_DOWN is surrounded by "":
"MyGeneral.Type("Key.PAGE_DOWN")
 File "\\MyPath\MyGeneral.sikuli\MyGeneral.py", line 69, in Type
 type(TextToType) 
at sun.awt.windows.WRobotPeer.keyPress(Native Method) 
at java.awt.Robot.keyPress(Unknown Source) 
at org.sikuli.script.DesktopRobot.doType(DesktopRobot.java:111) 
at org.sikuli.script.DesktopRobot.typeChar(DesktopRobot.java:118) 
at org.sikuli.script.Region.type(Region.java:809) 
at org.sikuli.script.Region.type(Region.java:789) 
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) 
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) 
at java.lang.reflect.Method.invoke(Unknown Source) 

java.lang.IllegalArgumentException: java.lang.IllegalArgumentException: Invalid key code"


Any idea from the community ?

Thanks

-- 
You received this question notification because you are a member of
Sikuli Drivers, which is an answer contact for Sikuli.