vncdotool is a command-line VNC client that also provides a Python API for programmatic interaction with VNC servers. It enables automation of VNC sessions, including screen capture, sending keystrokes, and executing commands, making it useful for testing, system administration, and CI/CD pipelines. The library is currently at version 1.3.0 and has an active but irregular release cadence.
pip install vncdotoolVerified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates how to connect to a VNC server using the `VNCClient` API, capture a screenshot, type some text, and then disconnect. It uses environment variables for host, port, and password for secure credential handling, falling back to common defaults.
Upgrade your Python environment to Python 3 (3.6+ is recommended for modern features and type hinting). Reinstall vncdotool in the Python 3 environment.
Upgrade to vncdotool version 1.2.0 or later to benefit from the fixes related to these API calls. Always ensure proper `try...finally` blocks for connection management.
Ensure your project uses `Pillow` for image manipulation and avoids direct `PIL` imports. If you were manipulating images returned by `vncdotool`, ensure your code is compatible with `Pillow`'s API.
If your script requires faster command execution or you experience unexpected delays, you can explicitly set the pause duration using `client.pause(milliseconds)` or `client.setTimeout(milliseconds)` methods within the API.