← Back to team overview

sikuli-driver team mailing list archive

[Question #241789]: unicode error when copying Env.getClipboard()

 

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

This is a snippet of code that's causing me an error:

description = ""
doubleClick(someScreenshot)
wait(1)
type(Key.RIGHT, KeyModifier.CTRL)
type(Key.RIGHT, KeyModifier.CTRL)
type (Key.END, KeyModifier.SHIFT + KeyModifier.CTRL)
type("c", KeyModifier.CTRL)
description = str(Env.getClipboard())

The objective of this code is to parse an email and copy the information to put into an object. This specific section of code pulls the information out of the user submitted information. One one email a user had the following information:

Apple Gift Card: value £25.00

The script produced the following error due to the '£' symbol:

[error] UnicodeEncodeError ( 'ascii' codec can't encode character u'\xa3' in position 23: ordinal not in range(128) )

I know I need to (dis)allow UTF-8 to get around this, but I can't seem to find a way to make it work with Env.getClipboard. It seems like I need an import of some variety, but I can't seem to make it work, can anyone help resolve this? Thanks.

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