Valueerror: Invalid Literal For Int() With Base 10: ' ' When It Worked Before
I'm having some issues with my program, basically what I'm trying to do is Stenography, insert an image into another image and then extract the secret image. My program is able to
Solution 1:
fileSize = ''.join(binascii.unhexlify('%x' % int(b,2)) for b in
lsbByte_Array[0:len(lsbByte_Array) - 1])
if lsbByte_Array
is an empty array then fileSize
will be an empty string, which is obviously why int(fileSize)
fails.
You should probably use a default value, for example
fileSize = ''.join(binascii.unhexlify('%x' % int(b,2)) for b in
lsbByte_Array[0:len(lsbByte_Array) - 1]) or0
As a side note, stuff like lsbByte_Array[0:len(lsbByte_Array) - 1])
can simply be written as lsbByte_Array[0:-1]
.
Solution 2:
I feel really dumb, I just needed to hear it from other people, it turns out in my infinite wisdom, I just tried opening images without actual hidden data in it. But I did fix up my code as other users here advised me to. Thanks for everything guys!
Post a Comment for "Valueerror: Invalid Literal For Int() With Base 10: ' ' When It Worked Before"