xpirt / img2sdat

Convert sparse EXT4 image to sparse Android data image
MIT License
156 stars 98 forks source link

common.py / python 2 & 3 #9

Closed TiceRex closed 7 years ago

TiceRex commented 7 years ago
  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 commented 7 years ago

Fixed with img2sdat 1.5.

Let me know of any issues.

TiceRex commented 7 years ago

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 commented 7 years ago

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]$