Chickenmarkus
Chickenmarkus

Reputation: 1161

Include PyVISA with VISA library into EXE of cx_Freeze

On my development PC with NI-VISA installed everything works fine. Now I try to make a "All-In-One"-Executable over cx_Freeze for other PCs. I figured out the following DLLs which I include over my setup.py (same way I do it succesfully with GTK+3).

###################
##### NI-VISA #####
###################

## path to Windows libraries
visa_windows_dir = os.path.join("C:\\", "Windows", "SysWOW64")

## list of missing dlls from Windows directory
missing_visa_windows = [# Listdll.exe(with PyVISA) minus Listdll.exe(without PyVISA)
                    'msvcr71.dll',
                    'nipal32.dll',
                    'nipalu.dll',
                    'NiViSv32.dll',
                    'nipalut.dll',
                    'nirpc.dll',
                    'visa32.dll'
                    #'crypt32.dll',
                    #'msasn1.dll',
                    #'wintrust.dll',
                    #'winusb.dll',
                    #'wsock32.dll'
                ]


## path to visa libraries
visa_program_dir = os.path.join("C:\\", "Program Files (x86)",
                                "IVI Foundation", "VISA", "WinNT")

## list of missing dlls from program directory
missing_visa_program = [# from Listdlls.exe
                        os.path.join("Bin", "NiVi488.dll"),
                        os.path.join("Bin", "NiViAsrl.dll"),
                        os.path.join("Bin", "NiViEnet.dll"),
                        os.path.join("Bin", "NiViEnetAsrl.dll"),
                        os.path.join("Bin", "NiViPxi.dll"),
                        os.path.join("Bin", "NiViRpc.dll"),
                        os.path.join("Bin", "NiViUsb.dll"),
                        os.path.join("NIvisa", "PxiPlugins", "NiViPpiD.dll"),
                        os.path.join("NIvisa", "PxiPlugins", "NiViPpiP.dll"),
                    ]

On running the EXE I still get the following Error: OSError: Could not found VISA library. Please install VISA or pass its location as an argument.

Which files/directories I have to include and how to pass its location to pyVISA for running in cx_Freeze environment?

Upvotes: 1

Views: 817

Answers (1)

Rognan
Rognan

Reputation: 31

It depends which backend do you use.

For example, I use package pyvisa with backend pyvisa-py after that only files you need to include in cx_freeze setup file is "visa32.dll" and package "pyvisa_py"

Upvotes: 1

Related Questions