srounet / Pymem

A python library for windows, providing the needed functions to start working on your own with memory editing.
MIT License
303 stars 45 forks source link

TypeError: 'MockObject' object is not callable #137

Closed Seraphli closed 1 month ago

Seraphli commented 1 month ago

Describe the bug

I'm running pymem on Linux, trying to hook steam game that runs with Proton. I can use psutil to find the process. But I can not open process with pymem.

Your Environment

  1. python version (3.6, 3.8...): 3.10.10
  2. os version (32/64): 64
  3. pymem version: 1.13.1

Expected behavior Open the process by pid.

Traceback

Traceback (most recent call last):
  File "/home/seraphli/Workspace/Github/Seraphli/DBH/memtest.py", line 26, in <module>
    pm = Pymem(process.pid)
  File "/home/seraphli/.pyenv/versions/3.10.10/lib/python3.10/site-packages/pymem/__init__.py", line 57, in __init__
    self.open_process_from_id(process_name)
  File "/home/seraphli/.pyenv/versions/3.10.10/lib/python3.10/site-packages/pymem/__init__.py", line 295, in open_process_from_id
    self.process_handle = pymem.process.open(self.process_id)
  File "/home/seraphli/.pyenv/versions/3.10.10/lib/python3.10/site-packages/pymem/process.py", line 191, in open
    set_debug_privilege('SeDebugPrivilege', True)
  File "/home/seraphli/.pyenv/versions/3.10.10/lib/python3.10/site-packages/pymem/process.py", line 121, in set_debug_privilege
    tp.get_array()[0].LUID = get_luid(lpszPrivilege)
  File "/home/seraphli/.pyenv/versions/3.10.10/lib/python3.10/site-packages/pymem/process.py", line 78, in get_luid
    res = pymem.ressources.advapi32.LookupPrivilegeValue(None, name, luid)
TypeError: 'MockObject' object is not callable

Additional context

I don't know if anyone test pymem with games runs on Proton. I'm expecting this works.

StarrFox commented 1 month ago

hello, this happens because you're running the pymem code on Linux which isn't supported

to use it with proton/wine you need to run it under those

so you'd install python and pymem in the same prefix as the game and then run it and it should just work