Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No devices found #641

Closed
bragostin opened this issue Oct 9, 2024 · 4 comments · Fixed by #643
Closed

No devices found #641

bragostin opened this issue Oct 9, 2024 · 4 comments · Fixed by #643

Comments

@bragostin
Copy link

That's an awesome package, thank you for developing it! Unfortunately after many trials I still can't make it work:

Debian 12
python 3.11.2 (main, Aug 26 2024, 07:20:54) [GCC 12.2.0]
nidaqmx                  1.0.1
numpy                    1.24.2

cat /run/nidevldu.status yields:

2 Device(s) Found:

Device 1
Device Type: cDAQ-9174
Device Identifier: cDAQ1
Device GUID: 2d20ec26-861f-11ef-80ca-3ce1a1512ad8
Device Driver Type: MXDF
iDriver Class Name: nNICSR100::tMarlinDriver
iDriverInitializer Class Name: nNICSR100::tCDAQChassisDriverInitializer
iDriverClient Class Name: nNICSR100::tCDAQChassisDriverClient
iDriverFinalizer Class Name: nNICSR100::tCDAQChassisDriverFinalizer
tDriverBroker::createDriver status: 0
post createDriver status: 0
Device Init time: 599 ms
Device Batch Number: 2

Device 2
Device Type: NI 9264
Device Identifier: cDAQ1Mod4
Device GUID: 33a19a73-861f-11ef-80ca-3ce1a1512ad8
Device Driver Type: MXDF
iDriver Class Name: nNICSR100::tCDAQCartridgeDriver
iDriverInitializer Class Name: nNICSR100::tCDAQCartridgeDriverInitializer
iDriverClient Class Name: nNICSR100::tCDAQCartridgeDriverClient
iDriverFinalizer Class Name: 
tDriverBroker::createDriver status: 0
post createDriver status: 0
Device Init time: 561 ms
Device Batch Number: 3

It seems the device is there and recognized by the nidaqmx driver.
However, [dev.name for dev in nidaqmx.system.System.local().devices] yields:

raceback (most recent call last):
  File "/home/chbrago/Documents/Labs/NI/Python/test.py", line 11, in <module>
    devices = [dev.name for dev in nidaqmx.system.System.local().devices]
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/chbrago/Documents/Labs/NI/Python/test.py", line 11, in <listcomp>
    devices = [dev.name for dev in nidaqmx.system.System.local().devices]
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/chbrago/cadquery/lib/python3.11/site-packages/nidaqmx/system/_collections/device_collection.py", line 71, in __iter__
    for device_name in self.device_names:
                       ^^^^^^^^^^^^^^^^^
  File "/home/chbrago/cadquery/lib/python3.11/site-packages/nidaqmx/system/_collections/device_collection.py", line 93, in device_names
    val = self._interpreter.get_system_info_attribute_string(0x193b)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/chbrago/cadquery/lib/python3.11/site-packages/nidaqmx/_library_interpreter.py", line 3455, in get_system_info_attribute_string
    return value.value.decode(lib_importer.encoding)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: decode() argument 'encoding' must be str, not None

Any idea?

@zhindes
Copy link
Collaborator

zhindes commented Oct 9, 2024

We get the encoding here. That uses locale.getlocale().

Can you open an interactive python prompt (just run python as is) and do this?

$ import locale
$ print(locale.getlocale())

@bkeryan
Copy link
Collaborator

bkeryan commented Oct 9, 2024

@zhindes This was also reported internally as AB#2827586. locale.getlocale() can return an encoding of None, so we ought to update nidaqmx-python to fall back to ASCII when the encoding is None.

@zhindes
Copy link
Collaborator

zhindes commented Oct 9, 2024

@bkeryan - Ah nice, I'll try to find time this week to make a PR to address that!

@bragostin - Try setting your language environment variables as specified in the locale man page.

@bragostin
Copy link
Author

bragostin commented Oct 10, 2024

@zhindes print(locale.getlocale()) yields (None, None)
Doing

export LC_ALL="en_US.UTF-8"
export LC_CTYPE="en_US.UTF-8"

actually solved the issue, Now [dev.name for dev in nidaqmx.system.System.local().devices] yields ['cDAQ1', 'cDAQ1Mod4']

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants