Bug/Problem Code lines 15, 46
sehHeiden opened this issue · 1 comments
Hi,
the line:
for dirname in os.listdir(name[0])[1:]: (line 15)
Is very problematic for any other OS than MacOS.
Here the first Class is excluded from the Project!!!!
I have done this instead:
if sys.platform == 'darwin':
file_range = os.listdir(name[0])[1:]
else:
file_range = os.listdir(name[0])
for dir_name in file_range:
path = os.path.join(name[0], dir_name)
Because I have no Mac.
Additionally the lines 45, 46 do not work for file number larger than the size of 2Byte!
header.append(int('0x'+hexval[2:][:2],16))
header.append(int('0x'+hexval[2:][2:],16))
And why do you use strings instread of a bitmask? My fix was:
for i in range(3, -1, -1):
val = len(FileList) # int(hexval, 16)
mask = 0xff << (i * 8)
erg = (val & mask) >> (i * 8)
print(str(erg))
header.append(erg)
But I am a novice to Tensorflow. Is it a must to use only 2 Byte for the number of files? If not, I would advice you to change that code!
@Meresmata GREAT!!Thank you! My problem was settled just now!I also have no Mac. When I ran these codes on Linux for reading 10 files, I found that the sixth file wasn't read anyway. After reading your comment, I just deleted the [1:]
which behind the for dirname in os.listdir(name[0])[1:]: (line 15)
. Now all of my files can be read.