pearu / pylibnidaqmx

a Python wrapper to libnidaqmx library
Other
10 stars 9 forks source link

PermissionError: [Errno 13] Permission denied: #74

Open dagouyi opened 1 year ago

dagouyi commented 1 year ago

Hi,

I try to setup a new computer and our old code using your package. I tried to run it but is shows some errors. Please see the following:

PS C:\lsip-measurement-pycontrol> & 'C:\ProgramData\anaconda3\python.exe' 'c:\Users\cascade.vscode\extensions\ms-python.python-2023.12.0\pythonFiles\lib\python\debugpy\adapter/../..\debugpy\launcher' '59785' '--' 'C:\lsip-measurement-pycontrol\Jet3\Jet.py' Generating 'C:\ProgramData\anaconda3\lib\site-packages\nidaqmx\nidaqmx_h_23_3.py' Traceback (most recent call last): File "C:\ProgramData\anaconda3\lib\site-packages\nidaqmx\libnidaqmx.py", line 203, in _load_header mod = import(pkg_name + mod_name, fromlist=[mod_name]) ModuleNotFoundError: No module named 'nidaqmx.nidaqmx_h_23_3'

During handling of the above exception, another exception occurred:

. . import nidaqmx File "C:\ProgramData\anaconda3\lib\site-packages\nidaqmx__init__.py", line 83, in from .libnidaqmx import AnalogInputTask, AnalogOutputTask,\ File "C:\ProgramData\anaconda3\lib\site-packages\nidaqmx\libnidaqmx.py", line 211, in _load_header(_header_name) File "C:\ProgramData\anaconda3\lib\site-packages\nidaqmx\libnidaqmx.py", line 205, in _load_header _convert_header(header_name, mod_name + ".py") File "C:\ProgramData\anaconda3\lib\site-packages\nidaqmx\libnidaqmx.py", line 184, in _convert_header with open(fn, 'w') as f: PermissionError: [Errno 13] Permission denied: 'C:\ProgramData\anaconda3\lib\site-packages\nidaqmx\nidaqmx_h_23_3.py' PS C:\lsip-measurement-pycontrol>

It seems that the program try to import a module named "nidaqmx_h_23_3.py". I check the folder, and I didn't find any file named nidaqmx_h_23_3.py.

Do you have any ideas about this issue? thank you.

hoechenberger commented 1 year ago

Hello @dagouyi, sorry for the late response. As you can probably tell, development on this package has basically been halted.

I suggest you take a look at the official NI Python package instead, which you can find at: https://github.com/ni/nidaqmx-python

Best wishes, Richard

pearu commented 1 year ago

When a file nidaqmx_h_X_Y.py does not exist, pylibnidaqmx tries to generate it. The PermissionError reported here is due to the fact that pylibnidaqmx cannot save the generated file to C:\ProgramData\anaconda3\lib\site-packages\nidaqmx\ because of lack of write permissions. If you enable the required permissions, the issue should be resolved.

development on this package has basically been halted.

This issue is not due to the halted development. It is rather a maintenance issue of updating the package to newer nidaqmx versions.