-
Notifications
You must be signed in to change notification settings - Fork 96
Open
Labels
Description
The following code is line 64, 65 and 66 from the main .py file:
for c in range(l - 1):
declare += str(payload[c]) + ", "
declare += str(payload[l - 1]) + "\n};\nint i = %d; //-snip-\n" % loop_countI ran this code with python 3.6, and got the following error:
Traceback (most recent call last):
File "C:\Users\PC1\Desktop\Programming\DigiSpark\duck2spark.py", line 155, in <module>
main(sys.argv[1:])
File "C:\Users\PC1\Desktop\Programming\DigiSpark\duck2spark.py", line 140, in main
result = generate_source(payload, init_delay=init_delay, loop_count=loop_count, loop_delay=loop_delay, blink=blink)
File "C:\Users\PC1\Desktop\Programming\DigiSpark\duck2spark.py", line 65, in generate_source
declare += str(hex(ord(payload[c]))) + ", "
TypeError: ord() expected string of length 1, but int found
Since I know some python, I decided to look into the problem and it turns out that simply removing the calls to hex() and ord() makes the script run without problems. I verified that the output still works.
Changed code becomes this:
for c in range(l - 1):
declare += str(payload[c]) + ", "
declare += str(payload[l - 1]) + "\n};\nint i = %d; //-snip-\n" % loop_countI have not tested with python 2.x.
3ldidi94, gstorelli, MrDh0nt, FelixGaebler, daskydasky and 2 more