Piano-LED-Visualizer icon indicating copy to clipboard operation
Piano-LED-Visualizer copied to clipboard

Clean up all invocations of python3

Open jwessel opened this issue 3 years ago • 4 comments

For maximum portability, convert to using #!/usr/bin/env python3 and change the execution bit in the git tree. That should mean even if it is copied the execute bit is preserved.

Signed-off-by: Jason Wessel [email protected]

jwessel avatar Jan 13 '22 15:01 jwessel

I'm getting

pi@raspberrypi:~ $ sudo /home/Piano-LED-Visualizer/visualizer.py
/usr/bin/env: ‘python3\r’: No such file or directory

also doesn't seem to start on reboot after editing crontab.

edit. which returns

pi@raspberrypi:~ $ sudo which python3
/usr/bin/python3

edit 2. It seems to be formatting problem? https://stackoverflow.com/questions/19425857/env-python-r-no-such-file-or-directory

onlaj avatar Jan 14 '22 09:01 onlaj

hmm... That seems odd. How do you checkout the git repository? Generally speaking you would only get the \r error if the file is formatted as a checkout from a Windows machine or if you have a git repository with the wrong value of core.autocrlf.

If you run "dos2unix visualizer.py" does the problem go away?

In my checkout, it just works. You can can still leave the "sudo python3 visualizer.py" if that is safer. I had made the change so I could directly execute it.

jwessel avatar Jan 17 '22 19:01 jwessel

Is it probably an OS thing? I am remembering you told somewhere you are not using the official Raspberry OS image. When creating a simple hello world script with the #!/usr/bin/env python3? line, it won't run for me as well. DOS vs. UNIX file formatting should not be an issue here.

SirLefti avatar Jan 18 '22 09:01 SirLefti

How do you checkout the git repository?

git fetch origin pull/320/head:python3

If you run "dos2unix visualizer.py" does the problem go away?

Yes, it works.

onlaj avatar Jan 18 '22 10:01 onlaj