DIYBookScanner / spreads

Modular workflow assistant for book digitization
GNU Affero General Public License v3.0
127 stars 53 forks source link

Camera configuration issue attribute 'list_cameras' #231

Closed altinukshini closed 8 years ago

altinukshini commented 8 years ago

I'm stuck here, could you please help?

:~$ spread configure
DJVU Language found sqi
Please select a device driver from the following list:
  [0]: Keep current (gphoto2camera)
  [1]: gphoto2camera
  [2]: chdkcamera
  [3]: dummy
  [4]: None
Select a driver: 1
Selected "gphoto2camera" as device driver
Please select your desired plugins from the following list:
  x 1: autorotate
  x 2: djvubind
    3: gui
    4: hidtrigger
    5: intervaltrigger
    6: pdfbeads
  x 7: scantailor
  x 8: tesseract
    9: web
Select a plugin (or hit enter to finish): 
The following postprocessing plugins were detected:
 - autorotate
 - scantailor
 - tesseract
Please enter the extensions in the order that they should be invoked, separated by commas or hit enter to keep the current order:

Do you want to configure the target_page of your devices?
(Required for shooting with two devices) [y/N]: y
Setting target page on cameras
Please connect and turn on the device labeled 'odd'
Press any key when ready.
spreads.plugin: Finding devices for driver "GPhoto2CameraDevice"
spreads encountered an error:
Traceback (most recent call last):
  File "/usr/local/lib/python2.7/dist-packages/spreads/main.py", line 321, in main
    run()
  File "/usr/local/lib/python2.7/dist-packages/spreads/main.py", line 308, in run
    args.subcommand(config)
  File "/usr/local/lib/python2.7/dist-packages/spreads/cli.py", line 232, in configure
    _set_device_target_page(config, target_page)
  File "/usr/local/lib/python2.7/dist-packages/spreads/cli.py", line 177, in _set_device_target_page
    devs = plugin.get_devices(config, force_reload=True)
  File "/usr/local/lib/python2.7/dist-packages/spreads/plugin.py", line 480, in get_devices
    devices = list(driver.yield_devices(config['device']))
  File "/usr/local/lib/python2.7/dist-packages/spreadsplug/dev/gphoto2camera.py", line 47, in yield_devices
    for cam in gphoto2.list_cameras():
AttributeError: 'module' object has no attribute 'list_cameras'
altinukshini commented 8 years ago

Here's the output of pip freeze |grep gphoto

gphoto2==1.4.1
gphoto2-cffi==0.3
altinukshini commented 8 years ago

Btw I'm using a "Nikon DSC D5200"

jbaiter commented 8 years ago

Yeah, you have your gphoto2 installations mixed up. gphoto2==1.4.1 is actually another gphoto2 wrapper that exports the same package. Due to this name clash, I had to rename the exported package name to gphoto2-cffi (in version 0.3, which currently does not work with spreads). The version for spreads is 0.2. So please run these commands to fix the situation:

$ pip uninstall gphoto2 gphoto2-cffi
$ pip install gphoto2-cffi==0.2
altinukshini commented 8 years ago

Ahh, right!! That worked.

Small correction: $ pip install gphoto2-cffi==0.2

However I still got the following after trying spread configure:

...
Please put a book with as little whitespace as possible under your cameras.
Press any button to continue
spreads encountered an error:
Traceback (most recent call last):
  File "/usr/local/lib/python2.7/dist-packages/spreads/main.py", line 321, in main
    run()
  File "/usr/local/lib/python2.7/dist-packages/spreads/main.py", line 308, in run
    args.subcommand(config)
  File "/usr/local/lib/python2.7/dist-packages/spreads/cli.py", line 246, in configure
    focus = devs[0]._acquire_focus()
  File "/usr/local/lib/python2.7/dist-packages/spreadsplug/dev/gphoto2camera.py", line 117, in _acquire_focus
    raise NotImplementedError
NotImplementedError

Exception AttributeError: "'NoneType' object has no attribute 'gp_camera_exit'" in <object repr() failed> ignored
jbaiter commented 8 years ago

Yeah, locking the focus is currently not supported with the gphoto2 driver, sorry :/ If your DSLR supports it, you can fiddle around with the manual focus until you get good results and then lock that. The driver will probably not support it for a while, since the necessary code will differ a lot between camera models and gphoto2 does not offer a high-level API for some the required functions (i.e. automatically setting the focus, reading the focus value from the camera, setting the focus to the stored value).

The interface should probably be clearer about this, though and not just throw an obscure error.