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
AirAPI_Windows.dll: GitHub - MSmithDev/AirAPI_Windows 
<https://github.com/MSmithDev/AirAPI_Windows/tree/master>

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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/pyinstaller/b86b324f-9d2c-457c-8d51-8c6af4d7c5abn%40googlegroups.com.

Reply via email to