[error] Env.getClipboard: cannot open system clipboard

Asked by James Panteleone on 2020-10-27

I have used these programs for many years and in the past few days i have been troubled with errors while accessing the system clipboard.

It's not on every use in my program. I collect data off the screen from a special spreadsheet. I used to be able to collect hundreds of lines but as of a couple of days ago, i get this error on the third or fourth line (copying ~15 elements).

clipboard.setContents(StringSelection(""), None)
sleep(1)
type("c", KEY_CTRL)
DOB = Env.getClipboard().strip()

Maybe i'm using some old methods.

SikuliXIDE-2.0.4
JRE 8
Windows 10

Question information

Language:
English Edit question
Status:
Answered
For:
Sikuli Edit question
Assignee:
No assignee Edit question
Last query:
2020-10-30
Last reply:
2020-10-30

This question was reopened

RaiMan (raimund-hocke) said : #1

--- clipboard.setContents(StringSelection(""), None)
what is this?

what error do you get?

--- clipboard.setContents(StringSelection(""), None) , sets the clipboard to a null state so i assure i dont carry the previous variable to the next variable.

[error] Env.getClipboard: cannot open system clipboard - is the error. I slowed down the copy and move clipboard data to a variable with sleep(1) on either side, before and after each and it still happens.

This has worked for 8+ months on this computer. I tested the same program on my laptop and it works without error. Running it routinely on the laptop is not possible.

RaiMan (raimund-hocke) said : #3

So you have to check, what has changed on the system, where you get the error.

It looks like some access right restrictions.

Or is the system clipboard blocked by some other app, that uses the clipboard (e.g. a Remote Desktop app or a virtual machine?)

what would be the most stable way to clear the clipboard contents?

masuo (masuo-ohara) said : #5

@James Panteleone

there is a setter for clipboard.
App.setClipboard("")

https://answers.launchpad.net/sikuli/+question/669258

Can you help with this problem?

Provide an answer of your own, or ask James Panteleone for more information if necessary.

To post a message you must log in.