1 |
In my validation script I'm running into a bizarre issue. |
2 |
|
3 |
This script fails if run under dumbo: |
4 |
https://github.com/rich0/gitvalidate/raw/master/gitdump/iteratetree.py |
5 |
|
6 |
The dumbo command line was: |
7 |
dumbo start iteratetree.py -input /outfile.csv -output /out |
8 |
|
9 |
Outfile.csv just had 3 entries in it for testing (generated by |
10 |
parsetrees.py in that directory). |
11 |
|
12 |
It failed with a KeyError on the line: |
13 |
tree=repository[unicode(filehash)]; |
14 |
|
15 |
The KeyError error message contained the correct hash. |
16 |
|
17 |
To eliminate variables I confirmed that replacing that line with this |
18 |
one generates the same error message: |
19 |
tree=Repository("/data/git/gentoo-x86")[unicode('5789de7076bfc534787fb3b072652810ca1ad197')] |
20 |
|
21 |
(all I did was hard-code everything for one entry to cut out all the |
22 |
other parsing logic). |
23 |
|
24 |
However, the following script works just fine: |
25 |
#!/usr/bin/python |
26 |
|
27 |
from pygit2 import Repository,GIT_OBJ_TREE; |
28 |
tree=Repository("/data/git/gentoo-x86")[unicode('5789de7076bfc534787fb3b072652810ca1ad197')] |
29 |
print tree |
30 |
|
31 |
Those are the exact same statements from the failing script, with the |
32 |
same hard-coded values. Running those commands interactively works |
33 |
fine also, as does stepping through the script logic. |
34 |
|
35 |
The main difference is how the execution flow reaches that point. In |
36 |
the simple script it is just outright run. In the case of the failing |
37 |
one it is in an iterator that is invoked by dumbo. |
38 |
|
39 |
Has anybody seen this kind of behavior in python - where an interator |
40 |
fails if it is called as part of a map statement but the same |
41 |
statements otherwise work normally? Perhaps I'm committing some |
42 |
obscure (to me) python sin. |
43 |
|
44 |
Rich |