Re: [PyInstaller] Win11 Pyinstall ctypes dll OSError: exception: access violation reading 0x0000000000000000

60 views
Skip to first unread message

Chris Barker

unread,
Aug 8, 2024, 4:01:49 PM8/8/24
to pyins...@googlegroups.com
vispy is built on top of OpenGL -- and it looks like your code (that's failing) is doing some pretty darn low-level stuff.

*maybe* the vispy import is causing a different version of some library (that AirAPI also uses).

Not really sure how to debug this, but I'd look at what libs are getting brought in in the built app (dont do it one-file at this point, so you can see everything that there) compare what happens with and without the vispy import.

Good luck!

-CHB

 

On Thu, Aug 8, 2024 at 5:38 AM Yang Chen <cheny2....@gmail.com> wrote:
My Python script works just fine, but something wrong with the exe generated by Pyinstaller.

Error message:
Traceback (most recent call last):
  File "main.py", line 3, in <module>
    print(XReal.get_arr())
  File "XReal.py", line 9, in get_arr
    ptr = self.dll.GetEuler()
OSError: exception: access violation reading 0x0000000000000000


Source code:
XReal.py:
import ctypes
class xreal:
    def __init__(self):
        self.dll = ctypes.CDLL('AirAPI_Windows.dll')
        self.dll.StartConnection()
        self.dll.GetEuler.restype = ctypes.POINTER(ctypes.c_float)
        self.arr = (ctypes.c_float * 3)()
    def get_arr(self):
        ptr = self.dll.GetEuler()
        ctypes.memmove(self.arr, ptr, ctypes.sizeof(self.arr))
        return list(self.arr)
XReal = xreal()

main.py:
from XReal import XReal
while True:
    print(XReal.get_arr())
import vispy # If this line is commented out, the exe generated works as expected.


The pyinstaller command:
pyinstaller main.py


Environment information:
OS: Win11
Python: 3.7.5
Pyinstaller: 5.13.2
vispy: 0.6.4

Any suggestions?

Thanks in advance.

--
You received this message because you are subscribed to the Google Groups "PyInstaller" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pyinstaller...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/pyinstaller/b86b324f-9d2c-457c-8d51-8c6af4d7c5abn%40googlegroups.com.


--

Christopher Barker, Ph.D.
Oceanographer

Emergency Response Division
NOAA/NOS/OR&R            (206) 526-6959   voice
7600 Sand Point Way NE   (206) 526-6329   fax
Seattle, WA  98115       (206) 526-6317   main reception

Chris....@noaa.gov
Reply all
Reply to author
Forward
0 new messages