DIYBookScanner / spreads

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

Can't configure devices? #228

Closed SanZamoyski closed 8 years ago

SanZamoyski commented 8 years ago

Hi!

I can not get it to work, i get this error while using Spreads Wizard (gui):

spread gui
Bus::open: Can not get ibus-daemon's address. 
IBusInputContext::createInputContext: no connection to ibus-daemon 
KGlobal::locale(): Warning your global KLocale is being recreated with a valid main component instead of a fake component, this usually means you tried to call i18n related functions before your main component was created. You should not do that since it most likely will not work
Object::connect: No such signal org::freedesktop::UPower::DeviceAdded(QDBusObjectPath)
Object::connect: No such signal org::freedesktop::UPower::DeviceRemoved(QDBusObjectPath)
Traceback (most recent call last):
  File "/usr/local/lib/python2.7/dist-packages/spreadsplug/gui/gui.py", line 235, in validatePage
    wizard.workflow.prepare_capture()
  File "/usr/local/lib/python2.7/dist-packages/spreads/workflow.py", line 875, in prepare_capture
    "Target page for at least one of the devices could not be"
spreads.util.DeviceException: Target page for at least one of the devices could not bedetermined, please run 'spread configure' to configure yourdevices.

Reconfigured spread multiple times, but still nothing...

Tried as root too. spread configure works fine (even focus), but not with gui.

jbaiter commented 8 years ago

Does capturing images from the command-line work? Which camera driver are you using with which camera model? Can you try running both the GUI and the CLI with the '--verbose' flag (has to be passed in before the respective subcommand)?

SanZamoyski commented 8 years ago

While installing by pip install spread i get some error (reported here, but with no solution: http://www.diybookscanner.org/forum/viewtopic.php?p=17162&sid=426109553a27314dfefeeec07dacdb0b#p17162).

w/o gui:

spread --verbose capture  ./
Workflow: Initializing workflow ./
bagit: Adding path /media/ext4/Projekty/OCR Machine/spread/bag-info.txt to payload
bagit: Adding path /media/ext4/Projekty/OCR Machine/spread/bag-info.txt to payload
bagit: Adding path /media/ext4/Projekty/OCR Machine/spread/bag-info.txt to payload
bagit: Adding path /media/ext4/Projekty/OCR Machine/spread/bag-info.txt to payload
bagit: Adding path /media/ext4/Projekty/OCR Machine/spread/bag-info.txt to payload
bagit: Adding path /media/ext4/Projekty/OCR Machine/spread/bag-info.txt to payload
bagit: Adding path config.yml to payload
spreads.plugin: Finding devices for driver "CHDKCameraDevice"
Found 1 devices!
root: 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 330, in capture
    raise DeviceException("At least one of the devices has not been"
DeviceException: At least one of the devices has not been properly configured, please re-run the program with the 'configure' option!

There is a problem with your device configuration: At least one of the devices has not been properly configured, please re-run the program with the 'configure' option!

GUI:

spread --verbose gui
sh: 0: getcwd() failed: No such file or directory
sh: 0: getcwd() failed: No such file or directory
spreadsplug.gui: Starting GUI
Bus::open: Can not get ibus-daemon's address. 
IBusInputContext::createInputContext: no connection to ibus-daemon 
KGlobal::locale(): Warning your global KLocale is being recreated with a valid main component instead of a fake component, this usually means you tried to call i18n related functions before your main component was created. You should not do that since it most likely will not work
Object::connect: No such signal org::freedesktop::UPower::DeviceAdded(QDBusObjectPath)
Object::connect: No such signal org::freedesktop::UPower::DeviceRemoved(QDBusObjectPath)
spreadsplug.gui: Updating config from widgets for plugin device
spreadsplug.gui: Trying to set key "parallel_capture"
spreadsplug.gui: Setting to "True"
spreadsplug.gui: Trying to set key "upside_down"
spreadsplug.gui: Setting to "False"
spreadsplug.gui: Trying to set key "flip_target_pages"
spreadsplug.gui: Setting to "False"
spreadsplug.gui: Trying to set key "focus_distance"
spreadsplug.gui: Trying to set key "sensitivity"
spreadsplug.gui: Trying to set key "shoot_raw"
spreadsplug.gui: Setting to "False"
spreadsplug.gui: Trying to set key "zoom_level"
spreadsplug.gui: Trying to set key "shutter_speed"
spreadsplug.gui: Setting to "1/25"
spreadsplug.gui: Trying to set key "monochrome"
spreadsplug.gui: Setting to "False"
spreadsplug.gui: Trying to set key "focus_mode"
spreadsplug.gui: Setting to "autofocus_all"
spreadsplug.gui: Trying to set key "whitebalance"
spreadsplug.gui: Setting to "Auto"
spreadsplug.gui: Trying to set key "dpi"
Workflow: Initializing workflow /home/san/Projekty/OCR Machine/
bagit: Adding path /home/san/Projekty/OCR Machine/bag-info.txt to payload
bagit: Adding path /home/san/Projekty/OCR Machine/config.yml to payload
Workflow: Preparing capture.
spreads.plugin: Finding devices for driver "CHDKCameraDevice"
Traceback (most recent call last):
  File "/usr/local/lib/python2.7/dist-packages/spreadsplug/gui/gui.py", line 235, in validatePage
    wizard.workflow.prepare_capture()
  File "/usr/local/lib/python2.7/dist-packages/spreads/workflow.py", line 875, in prepare_capture
    "Target page for at least one of the devices could not be"
spreads.util.DeviceException: Target page for at least one of the devices could not bedetermined, please run 'spread configure' to configure yourdevices.

BTW. spread cleared whole directory i've used for project - uncool!

spread -V
spreads 0.5git20160406.9f79

Licensed under the terms of the GNU Affero General Public License 3.0.
(C) 2013-2014 Johannes Baiter <johannes.baiter@gmail.com>
For a complete list of contributors see:
https://github.com/DIYBookScanner/spreads/graphs/contributors
SanZamoyski commented 8 years ago

By installing spread by

i got: sudo pip install git+git://github.com/jbaiter/spreads.git@master

sudo spread gui
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/4.8/../../../x86_64-linux-gnu/libturbojpeg.a(libturbojpeg_la-turbojpeg.o): relocation R_X86_64_32 against `.data' can not be used when making a shared object; recompile with -fPIC
/usr/lib/gcc/x86_64-linux-gnu/4.8/../../../x86_64-linux-gnu/libturbojpeg.a: error adding symbols: Zła wartość
collect2: error: ld returned 1 exit status
Error: "/var/tmp/kdecache-san" is owned by uid 1000 instead of uid 0.
Bus::open: Can not get ibus-daemon's address. 
IBusInputContext::createInputContext: no connection to ibus-daemon 
Traceback (most recent call last):
  File "/usr/local/lib/python2.7/dist-packages/spreadsplug/gui/gui.py", line 217, in validatePage
    wizard.workflow.prepare_capture()
  File "/usr/local/lib/python2.7/dist-packages/spreads/workflow.py", line 210, in prepare_capture
    if any(dev.target_page is None for dev in self.devices):
  File "/usr/local/lib/python2.7/dist-packages/spreads/workflow.py", line 80, in devices
    self._devices = plugin.get_devices(self.config, force_reload=True)
  File "/usr/local/lib/python2.7/dist-packages/spreads/plugin.py", line 393, in get_devices
    devices = list(driver.yield_devices(config['device']))
  File "/usr/local/lib/python2.7/dist-packages/spreadsplug/dev/chdkcamera.py", line 90, in yield_devices
    yield cls(config, dev)
  File "/usr/local/lib/python2.7/dist-packages/spreadsplug/dev/chdkcamera.py", line 104, in __init__
    usb.util.get_string(device, 256, device.iSerialNumber)
  File "/usr/local/lib/python2.7/dist-packages/usb/util.py", line 318, in get_string
    raise ValueError("The device does not support the specified langid")
ValueError: The device does not support the specified langid
jbaiter commented 8 years ago

BTW. spread cleared whole directory i've used for project - uncool!

That is most definitely more than uncool, basically the worst thing a program could do :-/ I'm really sorry :cold_sweat:

I think this was caused by a lack of documentation on my part: When you specify a directory for capturing, you should give the full name of the project directory, i.e. spread capture ./my-project. If there are already files in the specified directory and those files/directories are not laid out in the BagIt structure that spreads uses, it will copy them to a temporary path, then remove the old directory and create a new directory with the old files in its place. So in theory all your files should still be in ./, but it could be that this failed since spreads removed the working directory, and then "./" could no longer be resolved. I will probably remove this whole "convert to BagIt structure" functionality completely, it was mainly intended for users of an older version to migrate their projects. I hope you did not lose any important files!

Now, to your main problem: You're installing spreads from the wrong location! The official repository is DIYBookScanner/spreads and not jbaiter/spreads! The latter is a personal fork of mine that is far behind the current codebase.

Please install spreads from the proper repository and then run spread --verbose configure from the command-line and post the output here. That way I can see if your problem starts already with configuration or if it's something else further along in the process.

SanZamoyski commented 8 years ago

I hope you did not lose any important files! me too!

Installed by: sudo pip install git+git://github.com/DIYBookScanner/spreads.git@master


> san@sammie-mint:~ > spread -V
> spreads 0.5git20160419.ff6a
> 
> Licensed under the terms of the GNU Affero General Public License 3.0.
> (C) 2013-2014 Johannes Baiter <johannes.baiter@gmail.com>
> For a complete list of contributors see:
> https://github.com/DIYBookScanner/spreads/graphs/contributors

> san@sammie-mint:~ > spread --verbose configure
> Please select a device driver from the following list:
>   [0]: Keep current (chdkcamera)
>   [1]: gphoto2camera
>   [2]: chdkcamera
>   [3]: dummy
>   [4]: None
> Select a driver: 2
> Selected "chdkcamera" as device driver
> Please select your desired plugins from the following list:
>     1: autorotate
>     2: djvubind
>   x 3: gui
>     4: hidtrigger
>     5: intervaltrigger
>     6: pdfbeads
>     7: scantailor
>     8: tesseract
>     9: web
> Select a plugin (or hit enter to finish): 
> Do you want to configure the target_page of your devices?
> (Required for shooting with two devices) [y/N]: 
> Do you want to setup the focus for your cameras? [y/N]: 
> Configuration file written to '/home/san/.config/spreads/config.yaml'
> san@sammie-mint:~ > sudo spread --verbose gui 
> /usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/4.8/../../../x86_64-linux-gnu/libturbojpeg.a(libturbojpeg_la-turbojpeg.o): relocation R_X86_64_32 against `.data' can not be used when making a shared object; recompile with -fPIC
> /usr/lib/gcc/x86_64-linux-gnu/4.8/../../../x86_64-linux-gnu/libturbojpeg.a: error adding symbols: Zła wartość
> collect2: error: ld returned 1 exit status
> usage: spread [-h] [-V] [--loglevel <info/critical/error/warning/debug>]
>               [--logfile <str>] [--no-convert-old] [--no-verbose]
>               {wizard,configure,guiconfigure,capture,postprocess,output,gui}
>               ...
> spread: error: unrecognized arguments: --verbose
> san@sammie-mint:~ > sudo spread gui          
> /usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/4.8/../../../x86_64-linux-gnu/libturbojpeg.a(libturbojpeg_la-turbojpeg.o): relocation R_X86_64_32 against `.data' can not be used when making a shared object; recompile with -fPIC
> /usr/lib/gcc/x86_64-linux-gnu/4.8/../../../x86_64-linux-gnu/libturbojpeg.a: error adding symbols: Zła wartość
> collect2: error: ld returned 1 exit status
> spreadsplug.gui: Starting GUI
> Error: "/var/tmp/kdecache-san" is owned by uid 1000 instead of uid 0.
> Bus::open: Can not get ibus-daemon's address. 
> IBusInputContext::createInputContext: no connection to ibus-daemon 
> spreadsplug.gui: Updating config from widgets for plugin device
> spreadsplug.gui: Trying to set key "parallel_capture"
> spreadsplug.gui: Setting to "True"
> spreadsplug.gui: Trying to set key "upside_down"
> spreadsplug.gui: Setting to "False"
> spreadsplug.gui: Trying to set key "flip_target_pages"
> spreadsplug.gui: Setting to "False"
> spreadsplug.gui: Trying to set key "focus_distance"
> spreadsplug.gui: Trying to set key "sensitivity"
> spreadsplug.gui: Trying to set key "shoot_raw"
> spreadsplug.gui: Setting to "False"
> spreadsplug.gui: Trying to set key "zoom_level"
> spreadsplug.gui: Trying to set key "shutter_speed"
> spreadsplug.gui: Setting to "1/25"
> spreadsplug.gui: Trying to set key "monochrome"
> spreadsplug.gui: Setting to "False"
> spreadsplug.gui: Trying to set key "focus_mode"
> spreadsplug.gui: Setting to "autofocus_all"
> spreadsplug.gui: Trying to set key "whitebalance"
> spreadsplug.gui: Setting to "Auto"
> spreadsplug.gui: Trying to set key "dpi"
> Workflow: Initializing workflow /home/san/Projekty/OCR Machine/spread
> bagit: Adding path /home/san/Projekty/OCR Machine/spread/bag-info.txt to payload
> bagit: Adding path /home/san/Projekty/OCR Machine/spread/config.yml to payload
> Workflow: Preparing capture.
> spreads.plugin: Finding devices for driver "CHDKCameraDevice"
> Traceback (most recent call last):
>   File "/usr/local/lib/python2.7/dist-packages/spreadsplug/gui/gui.py", line 235, in validatePage
>     wizard.workflow.prepare_capture()
>   File "/usr/local/lib/python2.7/dist-packages/spreads/workflow.py", line 875, in prepare_capture
>     "Target page for at least one of the devices could not be"
> spreads.util.DeviceException: Target page for at least one of the devices could not bedetermined, please run 'spread configure' to configure yourdevices.

Might it be I made something wrong while running (installing?) chdk on my camera? I'm quite sure it's quite impossible, but...


Ok, there might be something wrong with my ptp installation...

san@sammie-mint:~ > /usr/local/lib/chdkptp/chdkptp
pcall failed 2
error [string "require('main')"]:1: module 'main' not found:
        no field package.preload['main']
        no file '/usr/local/share/lua/5.2/main.lua'
        no file '/usr/local/share/lua/5.2/main/init.lua'
        no file '/usr/local/lib/lua/5.2/main.lua'
        no file '/usr/local/lib/lua/5.2/main/init.lua'
        no file './main.lua'
        no file '/usr/local/lib/lua/5.2/main.so'
        no file '/usr/local/lib/lua/5.2/loadall.so'
        no file './main.so'
jbaiter commented 8 years ago

Those errors you're getting are due to a badly set LUA_PATH variable. Here's the command from the chdkptp documentation: LUA_PATH="/path/to/chdkptp/lua/?.lua" /path/to/chdkptp As for CHDK on your camera, can you see the CHDK logo when starting the camera? Also, can you check on the camera's SD card if there's an OWN.TXT file? If so, what is its content?

SanZamoyski commented 8 years ago

after export LUA_PATH="/usr/local/lib/chdkptp/lua/?.lua" chdkptp works:

san@sammie-mint:/dev/shm > /usr/local/lib/chdkptp/chdkptp
___> quit

while spread, even with LUA_PATH does not:

san@sammie-mint:/dev/shm > LUA_PATH="/usr/local/lib/chdkptp/lua/?.lua" sudo spread gui /usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/4.8/../../../x86_64-linux-gnu/libturbojpeg.a(libturbojpeg_la-turbojpeg.o): relocation R_X86_64_32 against `.data' can not be used when making a shared object; recompile with -fPIC /usr/lib/gcc/x86_64-linux-gnu/4.8/../../../x86_64-linux-gnu/libturbojpeg.a: error adding symbols: Zła wartość collect2: error: ld returned 1 exit status spreadsplug.gui: Starting GUI Error: "/var/tmp/kdecache-san" is owned by uid 1000 instead of uid 0. Bus::open: Can not get ibus-daemon's address. IBusInputContext::createInputContext: no connection to ibus-daemon spreadsplug.gui: Updating config from widgets for plugin device spreadsplug.gui: Trying to set key "parallel_capture" spreadsplug.gui: Setting to "True" spreadsplug.gui: Trying to set key "upside_down" spreadsplug.gui: Setting to "False" spreadsplug.gui: Trying to set key "flip_target_pages" spreadsplug.gui: Setting to "False" spreadsplug.gui: Trying to set key "focus_distance" spreadsplug.gui: Trying to set key "sensitivity" spreadsplug.gui: Trying to set key "shoot_raw" spreadsplug.gui: Setting to "False" spreadsplug.gui: Trying to set key "zoom_level" spreadsplug.gui: Trying to set key "shutter_speed" spreadsplug.gui: Setting to "1/25" spreadsplug.gui: Trying to set key "monochrome" spreadsplug.gui: Setting to "False" spreadsplug.gui: Trying to set key "focus_mode" spreadsplug.gui: Setting to "autofocus_all" spreadsplug.gui: Trying to set key "whitebalance" spreadsplug.gui: Setting to "Auto" spreadsplug.gui: Trying to set key "dpi" Workflow: Initializing workflow /home/san/Projekty/OCR Machine/spread bagit: Adding path /home/san/Projekty/OCR Machine/spread/bag-info.txt to payload bagit: Adding path /home/san/Projekty/OCR Machine/spread/config.yml to payload Workflow: Preparing capture. spreads.plugin: Finding devices for driver "CHDKCameraDevice" Traceback (most recent call last): File "/usr/local/lib/python2.7/dist-packages/spreadsplug/gui/gui.py", line 235, in validatePage wizard.workflow.prepare_capture() File "/usr/local/lib/python2.7/dist-packages/spreads/workflow.py", line 875, in prepare_capture "Target page for at least one of the devices could not be" spreads.util.DeviceException: Target page for at least one of the devices could not bedetermined, please run 'spread configure' to configure yourdevices.

shouldn't it be easier?

jbaiter commented 8 years ago

Just opening chdkptp won't tell you if CHDK is working on your camera and the computer <-> camera communication is working properly. Please read the chdkptp manual on the relevant commands. Also, please check if your camera boots CHDK properly (i.e. can you see the logo at startup, see my previous answer) and if the OWN.TXT file exists on the SD card (see also my previous answer).

shouldn't it be easier?

Absolutely, but there's a reason the software is still at pre-1.0. Plus, the multitude of cameras and the varying stability of their CHDK implementations will probably ensure that the whole stack will remain 'hacky'/'hobbyisty' for quite a while.

SanZamoyski commented 8 years ago

It definietly works (sorry, forgot to answer Your question - yes, i do see logo):

___> c connected: Canon PowerShot A480, max packet size 64 con> imls Thu Apr 14 14:22:44 2016 2378716 A/DCIM/104CANON/IMG_0005.JPG (...) Tue Apr 19 14:30:04 2016 1493854 A/DCIM/104CANON/IMG_0028.JPG

why doesn't it use this (Yours?) package https://pypi.python.org/pypi/pyptpchdk/0.2.1 ?

SanZamoyski commented 8 years ago

And how about this one (while configuring):

spreads.plugin: Finding devices for driver "CHDKCameraDevice" open_camera_dev_usb: ptp_opensession failed 0x2ff Device status OK

You wrote somewhere:

This happens when for some reason the driver loses connection to the camera, it will then try to re-connect up to two times, these are the messages from that from the low-level USB code. Does this break the workflow in your case? Do you have to restart the cameras manually?

And it seems for me that answer is no. There is no problem with connection at all (i belive).

jbaiter commented 8 years ago

Yes, it seems that way.

Also, please check [...] if the OWN.TXT file exists on the SD card (see also my previous answer).

Could you do that please? This file records for which side of the page spread the camera is responsible. It should be created during the configure step.

SanZamoyski commented 8 years ago

Will do! ...but unluckily i've left camera at university - so i'll do it in about 12h... anyway i've been configurint only one camera at the time - is that wrong?

SanZamoyski commented 8 years ago

No such file.

jbaiter commented 8 years ago

anyway i've been configurint only one camera at the time - is that wrong?

Ah, there we go, that's the issue. The software is currently designed for DIYBookScanner-typish scanners, which work with two cameras, one for each side of the page spread. Since you only have one camera, you probably (logically) skipped the "Do you want to set the target page..." part of the configure step. I just committed a change that should allow for single-camera usage, but keep in mind that this is not a use case that was tested, so depending on your choice of interface you could run into a few more issues. I'd recommend the command-line interface, it's the most bare-bones one and should work as-is.

SanZamoyski commented 8 years ago

That might be the case. Today i've configured it for two cameras and it works just fine. Thank You.

jbaiter commented 8 years ago

Thank you, that was definitely a bug in the code!