question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

ctypes.ArgumentError: argument 1: : expected LP_POINT instance instead of pointer to POINT

See original GitHub issue

Reported on StackOverflow: https://stackoverflow.com/q/57304399/3648361

Expected Behavior

Actual Behavior

ctypes.windll.user32.GetCursorPos(ctypes.byref(cursor))
ctypes.ArgumentError: argument 1: : expected LP_POINT instance instead of pointer to POINT

Steps to Reproduce the Problem

  1. Install pywinauto
  2. Install pyautogui==0.9.47
  3. Run the mentioned code

Short Example of Code to Demonstrate the Problem

slider = content_of_page.find_element_by_id("SystemSettings_Display_Brightness_Slider")
slider.click()
pyautogui.dragRel(args.value, 0, duration=1.0, button='left')
pyautogui.click()

Specifications

  • Pywinauto version: unknown
  • Python version and bitness: unknown
  • Platform and OS: Windows

We should think on how to eliminate such errors even if another library behaves incorrectly. Maybe do explicit type conversion for every Win32 API function call.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:8 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
airelilcommented, Oct 5, 2019

@vasily-v-ryabov, might be worth exploring an old suggestion from https://bugs.python.org/issue22552

If you want cached libs without polluting ctypes.cdll or ctypes.windll, just create your own instance such as windll = ctypes.LibraryLoader(ctypes.WinDLL).

0reactions
vasily-v-ryabovcommented, Oct 19, 2019

Well, it is fixed in master branch. Closing it before next release 0.6.8 (hope the last 0.6.x one).

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to fix types.ArgumentError: argument 1: <class 'TypeError ...
GetCursorPos(ctypes.byref(cursor)) ctypes.ArgumentError: argument 1: : expected LP_POINT instance instead of pointer to POINT.
Read more >
Issues with using C code in Python | Set 1 - GeeksforGeeks
ArgumentError : argument 3: : expected LP_c_int instance instead of int ... a ctypes.c_int is created and is passed in as the pointer...
Read more >
ctypes — A foreign function library for Python — Python 3.11.1 ...
ctypes is a foreign function library for Python. It provides C compatible data types, and allows calling functions in DLLs or shared libraries....
Read more >
glShaderSource and ctypes - Google Groups
ctypes.ArgumentError: argument 3: <type 'exceptions.TypeError'>: expected LP_LP_c_char instance instead of str definition: ... POINTER(GLchar)))
Read more >
How to Use Python Pointers | Nick McCullum
Surprisingly, pointers don't really exist in Python. ... ArgumentError: argument 1: <class 'TypeError'>: expected LP_c_int instance instead ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found