Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

64bit Access Error #47

Closed
glitchassassin opened this issue Jan 11, 2017 · 3 comments
Closed

64bit Access Error #47

glitchassassin opened this issue Jan 11, 2017 · 3 comments

Comments

@glitchassassin
Copy link
Owner

From @jazz1215:

Is there any chance that this issue relates to 32bit or 64bit Python?

I have 2 PCs, one with 32bit Python 2.7.12 and the other with 64bit Python 2.7.12 installed. Both have latest 0.5.2 Lackey installed with pip.

On the machine with 32bit, a failed Find will raise FindFailed exception, which is good. However, on the machine with 64bit Python, a "WIndowsError: exception access violation reading 0x0000000C00000000" will be raised. Please see below for details:

32Bit Python:
Python Version:
2.7.12 (v2.7.12:d33e0cf91556, Jun 27 2016, 15:19:22) [MSC v.1500 32 bit (Intel)]

Error:
[info] Couldn't find 'c:\testimage.png' with enough similarity.
Traceback (most recent call last):
  File "C:\guitest.py", line 11, in <module>
    print find(r'c:\testimage.png')
  File "C:\Python27\lib\site-packages\lackey\RegionMatching.py", line 386, in find
    raise FindFailed("Could not find pattern '{}'".format(path))
lackey.Exceptions.FindFailed: Could not find pattern 'c:\testimage.png'

64Bit Python
Python Version:
2.7.12 (v2.7.12:d33e0cf91556, Jun 27 2016, 15:24:40) [MSC v.1500 64 bit (AMD64)]

Exception:
Traceback (most recent call last):
  File "E:\guitest.py", line 11, in <module>
    print find(r'E:\testimage.png')
  File "E:\3rdParty\Python-2.7.12\lib\site-packages\lackey\RegionMatching.py", line 383, in find
    match = self.exists(pattern)
  File "E:\3rdParty\Python-2.7.12\lib\site-packages\lackey\RegionMatching.py", line 528, in exists
    matcher = TemplateMatcher(r.getBitmap())
  File "E:\3rdParty\Python-2.7.12\lib\site-packages\lackey\RegionMatching.py", line 349, in getBitmap
    return PlatformManager.getBitmapFromRect(self.x, self.y, self.w, self.h)
  File "E:\3rdParty\Python-2.7.12\lib\site-packages\lackey\PlatformManagerWindows.py", line 348, in getBitmapFromRect
    img = self._getVirtualScreenBitmap()
  File "E:\3rdParty\Python-2.7.12\lib\site-packages\lackey\PlatformManagerWindows.py", line 577, in _getVirtualScreenBitmap
    img = self._captureScreen(monitors[monitor_id]["name"])
  File "E:\3rdParty\Python-2.7.12\lib\site-packages\lackey\PlatformManagerWindows.py", line 438, in _captureScreen
    hdc = self._gdi32.CreateDCA(ctypes.c_char_p(device_name), 0, 0, 0)
WindowsError: exception: access violation reading 0x0000000C00000000
@glitchassassin
Copy link
Owner Author

ctypes expects 32-bit pointers by default. 64-bit pointers must be defined explicitly.

If that's all the issue is, this should be a pretty straightforward fix. I'll set up Python 3 x64 and test.

@glitchassassin
Copy link
Owner Author

I have pushed these changes to the develop branch and verified that the unit tests now work in 64-bit Python. I'll roll out a new release a little later this week.

@glitchassassin
Copy link
Owner Author

This has been fixed in the latest release.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant