kbrafford / pyfly2

Python wrapper for Point Grey Research's FlyCapture2 C API
18 stars 10 forks source link

cStringIO modules gone #12

Closed jagiella closed 8 years ago

jagiella commented 8 years ago

When I try to run the examples, I get the following error message:

$ python3 examples/simple/benchmark.py
Traceback (most recent call last):
  File "examples/simple/benchmark.py", line 2, in <module>
    import pyfly2
  File "pyfly2.pyx", line 15, in init pyfly2 (pyfly2.c:6933)
    #import cStringIO
ImportError: No module named 'cStringIO'

I read that the cStringIO module does not exist anymore and became part of the io module (refered article). Do you have any idea how to make it run anyways?

kbrafford commented 8 years ago

Pyfly2 isn't a python3 module yet. Use Python 2.7.

--Keith

"Bite off more than you can chew. THEN CHEW IT."

On Aug 8, 2016, at 6:39 AM, jagiella notifications@github.com wrote:

When I try to run the examples, I get the following error message: python3 examples/simple/benchmark.py Traceback (most recent call last): File "examples/simple/benchmark.py", line 2, in import pyfly2 File "pyfly2.pyx", line 15, in init pyfly2 (pyfly2.c:6933)

import cStringIO

ImportError: No module named 'cStringIO'

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub, or mute the thread.

jagiella commented 8 years ago

Thanks for your fast reply! Nevertheless, running the same example with python 2.7 produces the follwoing error:

$ python examples/simple/benchmark.py 
Traceback (most recent call last):
  File "examples/simple/benchmark.py", line 41, in <module>
    main()
  File "examples/simple/benchmark.py", line 38, in main
    test.Start()
  File "examples/simple/benchmark.py", line 19, in Start
    _ = self.camera.GrabPILImage()
  File "pyfly2.pyx", line 363, in pyfly2.Camera.GrabPILImage (pyfly2.c:4140)
    return Image.fromstring('L', (width, height), self.rawImage.pData[0:size])
  File "/usr/lib/python2.7/dist-packages/PIL/Image.py", line 2063, in fromstring
    "Please call frombytes() instead.")
Exception: fromstring() has been removed. Please call frombytes() instead.
kbrafford commented 8 years ago

Fixed and pushed. However I am not in a position to test it. Can you test it and close the issue if it works? Thanks!

jagiella commented 8 years ago

I pulled and recompiled. And I can confirm that the benchmark exmple is now working! All other examples already worked without your changes by the way.

kbrafford commented 8 years ago

Thanks for your help!