mabl / PyPylon

An experimental python wrapper around the Basler Pylon 5 library
BSD 3-Clause "New" or "Revised" License
53 stars 34 forks source link

cam.properties TypeError: Expected str, got unicode #3

Closed maxlklaxl closed 8 years ago

maxlklaxl commented 8 years ago

tested with GigE Basler acA640-120gm

In [15]: for image in cam.grap_images(1):
Traceback (most recent call last):
  File "test_pypylon.py", line 20, in <module>
    gen = cam.grap_image(1)
  File "PyPylon/cython/factory.pyx", line 233, in pypylon.cython.factory.Camera.grap_image (cython/factory.cpp:4756)
  File "PyPylon/cython/factory.pyx", line 215, in grap_images (cython/factory.cpp:4385)
TypeError: Expected str, got unicode

leading to

terminate called after throwing an instance of 'GenICam_3_0_Basler_pylon_v5_0::TimeoutException'
Aborted
maxlklaxl commented 8 years ago

after changing factory.pyx

215             cdef str image_format = str(self.properties['PixelFormat'])
216             cdef str bits_per_pixel_prop = str(self.properties['PixelSize'])

it worked

>>> for im in cam.grap_images(1): print im
[[187 175 181 ..., 255 255 255]
 [189 185 177 ..., 255 255 255]
 [189 179 186 ..., 255 255 255]
 ..., 
 [255 255 255 ..., 255 255 255]
 [255 255 255 ..., 255 255 255]
 [255 255 255 ..., 255 255 255]]
mabl commented 8 years ago

ah this is one of these Python 2 vs. 3 issues. I'll fix it.