morefigs / pymba

Python wrapper for Allied Vision's Vimba C API
MIT License
105 stars 84 forks source link

Wrong buffer initialization in vimbafeature._getStringFeature() #60

Closed honkomonk closed 5 years ago

honkomonk commented 7 years ago

Hi! I get an exception when I try to access string features from my AVT cameras.

Traceback (most recent call last): ... File "C:\Anaconda3\envs...\lib\site-packages\pymba\vimbaobject.py", line 37, in getattr return VimbaFeature(attr, self._handle).value File "C:\Anaconda3\envs...\lib\site-packages\pymba\vimbafeature.py", line 28, in value return self._getSetTypeFuncs[self._info.featureDataType][0]() File "C:\Anaconda3\envs...\lib\site-packages\pymba\vimbafeature.py", line 206, in _getStringFeature valueToGet = create_string_buffer('\000' * bufferSize) File "C:\Anaconda3\envs...\lib\ctypes__init__.py", line 63, in create_string_buffer raise TypeError(init) TypeError:

The exception is raised in the create_string_buffer() function in ctypes that expects either and intor an bytes parameter.

This is easy to fix by changing in vimbafeature.py the line (#206 as of now) from valueToGet = create_string_buffer('\000' * bufferSize) to valueToGet = create_string_buffer(bufferSize)

morefigs commented 5 years ago

Done in v0.2, thanks.