it should be fairly easy to modify this code so instead of outputting WIF, it simply converts to binary.
import bitcoin
file = open("hex.txt","r")
wif = open("wif.txt","w")
wifc = open("wifc.txt","w")
for line in file:
print(line)
wif.write(bitcoin.encode_privkey(line.strip(),'wif') + "\n")
wifc.write(bitcoin.encode_privkey(line.strip(),'wif_compressed') + "\n")
file.close()
wif.close()
wifc.close()
Anyway, are you able to show your code here so myself (and others) can try and debug why you're getting that error?