Closed philhanna closed 2 years ago
One difference I can find is that pxxd
supplies values for all options, whereas the IDE only has those I set in the unit test:
From IDE:
DEBUG: Arguments:
DEBUG: infile = /home/saspeh/PycharmProjects/xxd/testdata/short
DEBUG: outfile = /tmp/file2
From pxxd:
DEBUG: Arguments:
DEBUG: autoskip = False
DEBUG: binary = False
DEBUG: capitalize = False
DEBUG: cols = None
DEBUG: EBCDIC = False
DEBUG: little_endian = False
DEBUG: octets_per_group = None
DEBUG: include = False
DEBUG: len = None
DEBUG: name = None
DEBUG: offset = None
DEBUG: postscript = False
DEBUG: reverse = False
DEBUG: decimal = False
DEBUG: seek = None
DEBUG: uppercase = False
DEBUG: version = False
DEBUG: infile = testdata/short
DEBUG: outfile = None
Do one or more of these influence the formatting?
Here was the problem! In hex_dumper.py.__init__():174
:
Before:
# Cols option has different defaults depending on whether -ps or -i have been specified
if "postscript" in args:
self.cols = 30
elif "include" in args:
self.cols = 12
elif "binary" in args:
self.cols = 6
else:
self.cols = 16
After:
# Cols option has different defaults depending on whether -ps or -i have been specified
if args.get("postscript", False):
self.cols = 30
elif args.get("include", False):
self.cols = 12
elif self.binary:
self.cols = 6
else:
self.cols = 16
I was only checking for whether an option had been specified, not what its value was.
This resulted in self.cols
being set to 30, which messed up my width calculations.
The data is right, but the formatting is wrong :
With IDE:
With pxxd:
Similar with
-b
option specified: With IDE:With pxxd: