[1.1.0] Mac: App.getClipboard(): java.io.IOException: system clipboard data unavailable

Asked by Jonathan

I am using Sikui 1.1.0 Build:2015-06-24_01:00nightly on a MAC OS X 10.7.5.

My application clicks in a text region, selects it and copies it to the clipboard before processing this text further. My application can run and do this hundreds of times successfully and then suddenly I get the following error:-

[log] CLICK on L(718,1044)@S(0)[0,0 1920x1200]

[log] ( ? ) TYPE "a"

[log] ( ? ) TYPE "c"

java.io.IOException: system clipboard data unavailable
 at apple.awt.CClipboard.getClipboardData(Native Method)
 at sun.awt.datatransfer.ClipboardTransferable.fetchOneFlavor(ClipboardTransferable.java:101)
 at sun.awt.datatransfer.ClipboardTransferable.<init>(ClipboardTransferable.java:80)
 at sun.awt.datatransfer.SunClipboard.getContents(SunClipboard.java:130)
 at org.sikuli.script.App.getClipboard(App.java:659)
 at sun.reflect.GeneratedMethodAccessor40.invoke(Unknown Source)
 at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
 at java.lang.reflect.Method.invoke(Method.java:597)
 at org.python.core.PyReflectedFunction.__call__(PyReflectedFunction.java:186)
 at org.python.core.PyReflectedFunction.__call__(PyReflectedFunction.java:204)
 at org.python.core.PyObject.__call__(PyObject.java:371)
 at org.python.core.PyObject.__call__(PyObject.java:375)
 at readChatWindow$py.read$3(/Volumes/jonathanclark/Software Projects/Sikuli Scripts/Poke2/readChatWindow.sikuli/readChatWindow

.py:494)
 at readChatWindow$py.call_function(/Volumes/jonathanclark/Software Projects/Sikuli Scripts/Poke2/readChatWindow.sikuli/readChatWindow.py)
 at org.python.core.PyTableCode.call(PyTableCode.java:165)
 at org.python.core.PyBaseCode.call(PyBaseCode.java:149)
 at org.python.core.PyFunction.__call__(PyFunction.java:327)
 at org.python.core.PyMethod.__call__(PyMethod.java:124)
 at org.python.pycode._pyx314.f$0(/Volumes/jonathanclark/Software Projects/Sikuli Scripts/Poke2/main.sikuli/main.py:171)
 at org.python.pycode._pyx314.call_function(/Volumes/jonathanclark/Software Projects/Sikuli Scripts/Poke2/main.sikuli/main.py)
 at org.python.core.PyTableCode.call(PyTableCode.java:165)
 at org.python.core.PyCode.call(PyCode.java:18)
 at org.python.core.Py.runCode(Py.java:1275)
 at org.python.core.__builtin__.execfile_flags(__builtin__.java:522)
 at org.python.util.PythonInterpreter.execfile(PythonInterpreter.java:225)
 at org.sikuli.scriptrunner.JythonScriptRunner.runPython(JythonScriptRunner.java:208)
 at org.siku

li.scriptrunner.JythonScriptRunner.runScript(JythonScriptRunner.java:176)
 at org.sikuli.ide.SikuliIDE$ButtonRun$1.run(SikuliIDE.java:2369)

Looking through past faults there seems to be some references to this. Is there still a known fault? Is there a work around? What is happening? Can some other resource be grabbing the clipboard? Perhaps if I knew what I could disable it.

All help/suggestions welcome

Jonathan.

Question information

Language:
English Edit question
Status:
Solved
For:
SikuliX Edit question
Assignee:
No assignee Edit question
Solved by:
Jonathan
Solved:
Last query:
Last reply:
Revision history for this message
RaiMan (raimund-hocke) said :
#1

according to some bug posts in the net, this seems to be a special Mac/Java problem, where there is no solution.
Nothing special with SikuliX.

The recommendation is, to catch the exception and try again or ignore.

so you might do this:

isUnavailable = "#UNAVAILABLE#"
try:
    text = App.getClipboard()
catch:
    text = isUnavailable
if text == isUnavailable:
    # do corrective actions

Revision history for this message
Jonathan (jonathan-clark404) said :
#2

Thanks for your prompt reply. As you have suggested I have implemented an alternative strategy when this situation arises.