Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

common.py / python 2 & 3 #9

Closed
TiceRex opened this issue Oct 18, 2017 · 3 comments
Closed

common.py / python 2 & 3 #9

TiceRex opened this issue Oct 18, 2017 · 3 comments

Comments

@TiceRex
Copy link

TiceRex commented Oct 18, 2017

  File "/home/grbadmin/test/sdat_utils/common.py", line 112
    print "running: ", " ".join(args)
                    ^
SyntaxError: invalid syntax

Please help. What to do (running on python 3.4.5)?

@xpirt xpirt closed this as completed in 85ac2b4 Oct 18, 2017
@xpirt
Copy link
Owner

xpirt commented Oct 18, 2017

Fixed with img2sdat 1.5.

Let me know of any issues.

@TiceRex
Copy link
Author

TiceRex commented Oct 19, 2017

Thank you for the quick fix.
However, there seems to be other problems due to differences between python 2 and 3:

[grbadmin@granitgeo test]$ python3 sdat2img/img2sdat.py system.sdat ua 4
img2sdat binary - version: 1.5

Total of 215040 4096-byte output blocks in 4921 input chunks.
Finding transfers...
Generating digraph...
Finding vertex sequence...
Reversing backward edges...
0/0 dependencies (0.00%) were violated; 0 source blocks stashed.
Improving vertex order...
Traceback (most recent call last):
File "sdat2img/img2sdat.py", line 89, in
main(sys.argv)
File "sdat2img/img2sdat.py", line 83, in main
b.Compute(outdir)
File "/home/grbadmin/test/sdat2img/blockimgdiff.py", line 342, in Compute
self.AssertSequenceGood()
File "/home/grbadmin/test/sdat2img/blockimgdiff.py", line 814, in AssertSequenceGood
touched = array.array("B", "\0" * self.tgt.total_blocks)
TypeError: cannot use a str to initialize an array with typecode 'B'
[grbadmin@granitgeo test]$

@TiceRex TiceRex changed the title common.py common.py / python 2 & 3 Oct 19, 2017
@TiceRex
Copy link
Author

TiceRex commented Oct 19, 2017

The error above can be easily eliminated by changing blockimgdiff.py line 814 from
touched = array.array("B", "\0" * self.tgt.total_blocks)
to
touched = array.array("B", b"\0" * self.tgt.total_blocks)

But then another error happens, after creating the new dat file:
...
2097152 2097152 (100.00%) new __NONZERO-249 127489-128000
2097152 2097152 (100.00%) new __NONZERO-346 177153-177664
2097152 2097152 (100.00%) new __NONZERO-299 153089-153600
2097152 2097152 (100.00%) new __NONZERO-391 200193-200704
Traceback (most recent call last):
File "sdat2img/img2sdat.py", line 89, in
main(sys.argv)
File "sdat2img/img2sdat.py", line 83, in main
b.Compute(outdir)
File "/home/grbadmin/test/sdat2img/blockimgdiff.py", line 345, in Compute
self.WriteTransfers(prefix)
File "/home/grbadmin/test/sdat2img/blockimgdiff.py", line 417, in WriteTransfers
src_str.insert(1, unstashed_src_ranges.to_string_raw())
File "/home/grbadmin/test/sdat2img/rangelib.py", line 139, in to_string_raw
assert self.data
AssertionError
[grbadmin@granitgeo test]$

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

No branches or pull requests

2 participants