vncdotool icon indicating copy to clipboard operation
vncdotool copied to clipboard

Screen capture to non existing directory hangs forever

Open arossert opened this issue 6 years ago • 1 comments

When using the CLI tool to capture a screenshot and the directory is not exists, the command hang forever instead of returning an error.

vncdo capture non-exists/test.png

When using the API it is throwing an exception:

client = api.connect('127.0.0.1', password=None)
client.captureScreen('non-exists/screenshot.png')

The error is:

Traceback (most recent call last):
  File "/Users/arossert/tests/vnc_test/vnc_test.py", line 5, in <module>
    client.captureScreen('1/screenshot.png')
  File "/Users/arossert/tests/venv2/lib/python2.7/site-packages/vncdotool/api.py", line 111, in proxy_call
    raise VNCDoException(result)
vncdotool.api.VNCDoException: [Failure instance: Traceback: <type 'exceptions.IOError'>: [Errno 2] No such file or directory: '1/screenshot.png'
/Users/arossert/tests/venv2/lib/python2.7/site-packages/vncdotool/rfb.py:245:_doConnection
/Users/arossert/tests/venv2/lib/python2.7/site-packages/vncdotool/client.py:393:commitUpdate
/Users/arossert/tests/venv2/lib/python2.7/site-packages/twisted/internet/defer.py:460:callback
/Users/arossert/tests/venv2/lib/python2.7/site-packages/twisted/internet/defer.py:568:_startRunCallbacks
--- <exception caught here> ---
/Users/arossert/tests/venv2/lib/python2.7/site-packages/twisted/internet/defer.py:654:_runCallbacks
/Users/arossert/tests/venv2/lib/python2.7/site-packages/vncdotool/client.py:249:_captureSave
/Users/arossert/tests/venv2/lib/python2.7/site-packages/PIL/Image.py:1991:save

The CLI is probably catching the exception and ignoring it somewhere.

arossert avatar Mar 12 '19 14:03 arossert

Probably missing exception handling similar to https://github.com/sibson/vncdotool/issues/127#issuecomment-374045854

pmhahn avatar Feb 04 '23 12:02 pmhahn