#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2013
    Posts
    2
    Rep Power
    0

    So i have this code which uses ctypes.


    So i have some code written with python using ctypes. It uses the win32 api to create a window, it creates the window but then causes the python interpreter to crash. (It gets a windows "python.exe has stopped working" dialog box )

    The code will be used in an OpenGL Based application.

    I was going to post a link to a github page, but since im new here i cant post links.

    The crash happens both on python 2.7 and 3.3 (the code runs on both just fine)

    Any suggestions, should i take this elsewhere?

    Edit:
    Just opened the crash dump that windows made in Visual Studio, and it says this: The thread tried to read from or write to a virtual address for which it does not have the appropriate access.
  2. #2
  3. Contributing User
    Devshed Demi-God (4500 - 4999 posts)

    Join Date
    Aug 2011
    Posts
    4,850
    Rep Power
    481
    If python crashed, and you've used ctypes, then the problem is with your use of ctypes.
    You can post links if you're mildly clever.

    www dot time dot gov
    [code]Code tags[/code] are essential for python code and Makefiles!
  4. #3
  5. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Dec 2012
    Posts
    114
    Rep Power
    3
    Yeah, ctypes does very little to prevent you from trying to do something you shouldn't. You'd probably need someone familiar with the Win32 API to tell you exactly which line of code is the issue.

    You could try using cffi; from what I understand it does more to try and stop you from shooting yourself in the foot than ctypes does. Personally I find using it ugly as hell, though.
  6. #4
  7. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2013
    Posts
    2
    Rep Power
    0
    Well i figured it out. It wasnt any issue with my code python was just derefrencing my WNDCLASS.

IMN logo majestic logo threadwatch logo seochat tools logo