[1.1.0] Mac: App.getClipboard(): java.io.IOException: system clipboard data unavailable --- should be handled internally --- fixed 1.1.0

Bug #1469962 reported by RaiMan
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
SikuliX
Fix Committed
Critical
RaiMan

Bug Description

**** fixed 1.1.0 2015-07-01+
- exceptions handled internally
- empty string returned
- error messages
-------------------------------------------------

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.

Revision history for this message
RaiMan (raimund-hocke) wrote : Re: [1.1.0] Mac: App.getClipboard(): java.io.IOException: system clipboard data unavailable --- should be handled internally

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

Changed in sikuli:
status: New → In Progress
importance: Undecided → Medium
assignee: nobody → RaiMan (raimund-hocke)
milestone: none → 2.0.0
summary: [1.1.0] Mac: App.getClipboard(): java.io.IOException: system clipboard
- data unavailable
+ data unavailable --- should be handled internally
RaiMan (raimund-hocke)
Changed in sikuli:
status: In Progress → Fix Committed
importance: Medium → Critical
milestone: 2.0.0 → 1.1.0
summary: [1.1.0] Mac: App.getClipboard(): java.io.IOException: system clipboard
- data unavailable --- should be handled internally
+ data unavailable --- should be handled internally --- fixed 1.1.0
description: updated
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.