vncdotool icon indicating copy to clipboard operation
vncdotool copied to clipboard

TypeError: VNCDoToolClient.captureScreen() missing 1 required positional argument: 'fp'

Open viewstar000 opened this issue 7 months ago • 1 comments

client.captureScreen("tmp/1.png")

TypeError: VNCDoToolClient.captureScreen() missing 1 required positional argument: 'fp'

Environment:

Mac OS 15.5 (MacBookPro M4 MAX) Python 3.12 (Install via Brew, within VirtualEnv) vncdotool==1.2.0 Execute in Notebook (VS Code with Jupyter plugin)

Fixed:

Modify .venv/lib/python3.12/site-packages/vncdotool/client.py@256-266:

Add TClient annotation to self:

def captureScreen(self: TClient, fp: TFile, incremental: bool = False) -> Deferred:
    """Save the current display to filename"""
    log.debug("captureScreen %s", fp)
    return self._capture(fp, incremental)

def captureRegion(
    self: TClient, fp: TFile, x: int, y: int, w: int, h: int, incremental: bool = False
) -> Deferred:
    """Save a region of the current display to filename"""
    log.debug("captureRegion %s", fp)
    return self._capture(fp, incremental, x, y, x + w, y + h)

viewstar000 avatar May 20 '25 03:05 viewstar000

No, your fix is wrong: self does not need a type annotation.

https://github.com/sibson/vncdotool/blob/main/vncdotool/client.py#L256

Maybe related to #266

pmhahn avatar May 20 '25 11:05 pmhahn