I am a newbie in the python world and I am getting an typing error that I am unsure of:
...File "/home/simon/python/piptroubleshoot/Main.py", line 15, in main
hexToBase64(u'49276d206b696c6c696e6720796f757220627261696e206c696b65206120706f69736f6e6f7573206d757368726f6f6d')
File "/home/simon/python/piptroubleshoot/Main.py", line 10, in hexToBase64
base64.b64encode(hex(stream.read(4)))
TypeError: 'BitStream' object cannot be interpreted as an integer
Any ideas? This is the code the line in question is starred:
def hexToBase64(i: hex):
stream = bitstring.BitStream(hex=i)
while stream.length > 0:
**base64.b64encode(hex(stream.read(4)))**
def main():
""" Main program """
print(u'49276d206b696c6c696e6720796f757220627261696e206c696b65206120706f69736f6e6f7573206d757368726f6f6d')
hexToBase64(u'49276d206b696c6c696e6720796f757220627261696e206c696b65206120706f69736f6e6f7573206d757368726f6f6d')
return 0
if __name__ == "__main__":
main()