matham / rotpy

Python bindings for the Spinnaker SDK to enable Pythonic control of Teledyne/FLIR/Point Grey USB and GigE cameras.
MIT License
17 stars 0 forks source link

How to integrate with pyinstaller #5

Open z384647062 opened 6 months ago

z384647062 commented 6 months ago

I am using pyinstaller to package my project and an error occurs during execution:

Traceback (most recent call last):
...
File "PyInstaller\loader\pyimod02_importers.py", line 493, in exec_module
...
File "rotpy\system.pyx", line 1, in init rotpy.system
ModuleNotFoundError: No module named 'rotpy.node'

Update I added the hiddenimports parameter to pyinstaller.

hiddenimports=['rotpy.node','rotpy._interface','rotpy.names','rotpy.names.geni','rotpy.system_nodes','rotpy.names.camera','rotpy._cam_defs','rotpy._cam_defs._cam_defs1','rotpy._cam_defs._cam_defs2','rotpy._cam_defs._cam_defs3','rotpy._cam_defs._cam_defs4','rotpy._cam_defs._cam_defs5','rotpy.names.tl','rotpy.names.spin']

Now the application works, but the CPU usage is over 30% and my sample project only instantiates SpinSystem:

from rotpy.system import SpinSystem
import time

if __name__ == '__main__':
    system = SpinSystem()
    time.sleep(1000)