pearu / pylibnidaqmx

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

Unicode library name on latest anaconda 2 #67

Open histed opened 7 years ago

histed commented 7 years ago

Using a recent anaconda2 and master of pylibnidaqmx:

libnidaqmx.py seems to generate the DLL name (from ctypes) as unicode, and loading the library then raises an exception saying it expects str, not unicode.

This patch fixes the error. It's almost certainly not what you want to commit, but it works around the issue.

--- a/nidaqmx/libnidaqmx.py
+++ b/nidaqmx/libnidaqmx.py
@@ -108,6 +108,8 @@ def _find_library():
         header_name, libname, libfile = _find_library_nt()
     else:
         header_name, libname, libfile = _find_library_linux()
+    if type(libfile) is unicode:
+        libfile = str(libfile)

     lib = None
     if libfile is None:

$ conda --version conda 4.3.14

anaconda 4.3.1 np111py27_0 anaconda-client 1.6.0 py27_0 anaconda-navigator 1.5.0 py27_0 anaconda-project 0.4.1 py27_0

Python 2.7.13 |Anaconda 4.3.1 (64-bit)| (default, Dec 19 2016, 13:29:36) [MSC v. 1500 64 bit (AMD64)]

histed commented 5 years ago

@olsonse Is this potentially a result of your Py2/3 changes, and worth merging?

olsonse commented 4 years ago

Sorry for the delay. I'll look...

On Mon, Sep 9, 2019 at 3:34 PM Mark Histed notifications@github.com wrote:

@olsonse https://github.com/olsonse Is this potentially a result of your Py2/3 changes, and worth merging?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/pearu/pylibnidaqmx/issues/67?email_source=notifications&email_token=AABEJJ74NS37OZLPHQKXUILQI26MHA5CNFSM4DLZRRA2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD6JDOUQ#issuecomment-529676114, or mute the thread https://github.com/notifications/unsubscribe-auth/AABEJJ4DS2QLQFAQO55TJO3QI26MHANCNFSM4DLZRRAQ .

histed commented 4 years ago

bump?

olsonse commented 4 years ago

Someone else I am working with pointed this problems out also. We can't directly refer to 'unicode', since the goal is to remain py2/py3 compatible.

This was fixed by @pklapperich with 9149dddc : convert all libfile results from _find_library_nt to strings.