Skip to content
This repository has been archived by the owner on Jun 22, 2022. It is now read-only.

python -m utils.run_scan fails #8

Closed
chrismeyersfsu opened this issue Jul 21, 2013 · 4 comments
Closed

python -m utils.run_scan fails #8

chrismeyersfsu opened this issue Jul 21, 2013 · 4 comments

Comments

@chrismeyersfsu
Copy link
Contributor

run_scan seems to fail for me

meyers@tinylappy:~/Dropbox/Code/card_scan$ python -m utils.run_scan
VIDIOC_QUERYMENU: Invalid argument
VIDIOC_QUERYMENU: Invalid argument
VIDIOC_QUERYMENU: Invalid argument
Traceback (most recent call last):
File "/usr/lib/python2.7/runpy.py", line 162, in _run_module_as_main
"main", fname, loader, pkg_name)
File "/usr/lib/python2.7/runpy.py", line 72, in _run_code
exec code in run_globals
File "/home/meyers/Dropbox/Code/card_scan/utils/run_scan.py", line 45, in
next_box = session.query(func.max(sqlalchemy.cast(InvCard.box, sqlalchemy.Integer))).first()[0] + 1
TypeError: unsupported operand type(s) for +: 'NoneType' and 'int'

@YenTheFirst
Copy link
Owner

ah, it looks like this is the result of some hacky assumptions.

The basic idea on line 45 is, we want to put the newly scanned cards in the 'next' box. i.e., if there are at least some boxes in the collection which are named numerically, we find the largest of those, and add 1.

This is failing because, in a new collection, there are no boxes at all.

I'll implement a slightly more robust next_box logic. Eventually, 'box' as a varchar label might be replaced by something a bit more robust, if there's a strong need for it.

@YenTheFirst
Copy link
Owner

commit f284743 should fix this

@dampete
Copy link

dampete commented Jan 18, 2014

@YenTheFirst I have zero Python experience, having a hard time getting things started here. After finally managing to install all dependencies, when I run the script I get this:

scanning 01
OpenCV Error: Bad argument (Array should be CvMat or IplImage) in cvGetSize, fil
e ......\opencv-2.4.7.2\modules\core\src\array.cpp, line 1238
Traceback (most recent call last):
File "G:\Python27\lib\runpy.py", line 162, in _run_module_as_main
"main", fname, loader, pkg_name)
File "G:\Python27\lib\runpy.py", line 72, in _run_code
exec code in run_globals
File "D:\Projects\3rd Party\card_scan\utils\run_scan.py", line 53, in

capture_box(cam, next_box)

File "D:\Projects\3rd Party\card_scan\utils\run_scan.py", line 18, in capture_
box
captures = scan_card.watch_for_card(cam)
File "scan_card.py", line 51, in watch_for_card
size = cv.GetSize(img)
cv2.error: Array should be CvMat or IplImage

I'm on Windows, not sure if I installed incorrect versions of anything (I did have to manually edit Elixir because it was importing incorrectly from SQLAlchemy)

@YenTheFirst
Copy link
Owner

@dampete that looks like a separate issue. I've opened this up as a new issue, here: #10

When I get a chance, I'll try this out on a Windows machine, and see what happens

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants