Skip to content

python 3 support, ctypes error? #9

@tobeycarman

Description

@tobeycarman

I am trying to build aravis and python-aravis in a python3 environment and I am getting a ctypes.cast error.

I am on Ubuntu 16.04, and I installed python3.6 under conda. I was able to build aravis, and python-aravis with no errors (although I did have to monkey-patch aravis.py to import pgi instead of import gi). I then run my test script which is this:

#!/usr/bin/env python

import pgi
pgi.require_version('Aravis', '0.6')

import aravis
import time
import sys

FRAMES=4

available_cameras = aravis.get_device_ids()
if len(available_cameras) > 0:
  cam = aravis.Camera(available_cameras[0])
else:
  print("No camera is on. Quitting.")
  sys.exit(-1)  

cam.start_acquisition()
for i in range(0, FRAMES):
  print("Sleeping while capturing images...")
  time.sleep(1)
print("Stopping acq...")
cam.stop_acquisition()

print("Gonna show you some images here...")
for i in range(0, 2):
  print("Popping a frame...")
  try:
    d = cam.pop_frame()
    print("Frame {} is:".format(i))
    print(d)
  except Exception as e:
    print("UH OH, there was a problem!: ", e)
    raise e

for i in range(0, FRAMES):
  try:
    print("Saving {} of 5 frames...".format(i))
    aravis.sfn(cam, app.config['IMAGES_INCOMING'])
  except Exception as e:
    print("UH OH, there was a problem!: ", e)
    raise e

When I run my test script I get this:

$ ./test.py 
Sleeping while capturing images...
Sleeping while capturing images...
Sleeping while capturing images...
Sleeping while capturing images...
Stopping acq...
Gonna show you some images here...
Popping a frame...
UH OH, there was a problem!:  argument 1: <class 'TypeError'>: wrong type
Traceback (most recent call last):
  File "./test.py", line 35, in <module>
    raise e
  File "./test.py", line 30, in <module>
    d = cam.pop_frame()
  File "/home/vagrant/anaconda3/envs/py3/lib/python3.6/site-packages/aravis-0.5-py3.6.egg/aravis.py", line 153, in pop_frame
  File "/home/vagrant/anaconda3/envs/py3/lib/python3.6/site-packages/aravis-0.5-py3.6.egg/aravis.py", line 169, in try_pop_frame
  File "/home/vagrant/anaconda3/envs/py3/lib/python3.6/site-packages/aravis-0.5-py3.6.egg/aravis.py", line 191, in _array_from_buffer_address
  File "/home/vagrant/anaconda3/envs/py3/lib/python3.6/ctypes/__init__.py", line 485, in cast
    return _cast(obj, obj, typ)
ctypes.ArgumentError: argument 1: <class 'TypeError'>: wrong type

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions