Search code examples
pythonautopy

What is an "integer<H>"? (TypeError: argument must be integer<H>, not int)


I am trying to use a function from autopy and get the error message

TypeError: argument must be integer<H>, not int

What does this "integer<H>" mean?

My code:

import autopy, os, time
from autopy import key
time.sleep(1)
key.tap(key.K_RETURN)

Solution

  • The error indicates that autopy was not happy with the type of the passed key and that that type was int. What type it expected instead is (at least to me) completely unclear from the error message. integer<H> doesn't really mean anything in Python, AFAIK, so that doesn't make a lot of sense. Maybe this library has its own notation for type constraints.

    A comment on the autopy issue tracker mentions

    key.toggle(long(key.K_DELETE), True)
    

    as a workaround, which indicates that (in some situations, probably specific to operating system and/or Python version) the expected type is long. Applied to your code, that'd be

    key.tap(long(key.K_RETURN))