Python Arduino Demo - update for Python 3+

I am trying to run the python software, "ComArduino" which is posted as a sticky above. However, it would appear that some changes in Python 3 do not allow it to be run.

Aside from the easy to understand change invalid syntax in how print is commanded, now requiring parensesis () around the subject to be printed, there is some change in the way strings, bytes and concatenation is called for.

When I try to run it, I get the following error(s):

Traceback (most recent call last):
File "C:\Users\xx\AppData\Local\Programs\Python\Python37-32\ComArduino2 (1).py", line 163, in
waitForArduino()
File "C:\Users\xx\AppData\Local\Programs\Python\Python37-32\ComArduino2 (1).py", line 101, in waitForArduino
msg = recvFromArduino()
File "C:\Users\xx\AppData\Local\Programs\Python\Python37-32\ComArduino2 (1).py", line 79, in recvFromArduino
ck = ck + x
TypeError: can only concatenate str (not "bytes") to str

I have updated the Python - Arduino demo to include a Python3 version.

I think the Forum rules have changed and it won't now allow a .py file to be uploaded so I have uploaded it as a .txt file. Just change the file type to .py and it should work.

...R

Thanks Robin. For some reason on Windows 10, it would not recognize it as a py file after changing the extension on the name from .txt to .py. I followed your suggestion and copied it into a new py file and that worked perfectly.

Northof49:
For some reason on Windows 10, it would not recognize it as a py file after changing the extension on the name from .txt to .py.

Use Linux :slight_smile:

...R