rhyst / linak-controller

A Python script to control Linak standing desks.
MIT License
355 stars 52 forks source link

Fix shebang #30

Closed subraizada3 closed 2 years ago

subraizada3 commented 2 years ago

With the current #!python3, on Arch Linux:

$ ./main.py 
bash: ./main.py: python3: bad interpreter: No such file or directory

Using /usr/bin/env is more compatible across different systems and is a convention in most Python that I've seen. I have read on StackOverflow that this also works on macOS, though I don't have any macs which I can test on.

https://askubuntu.com/a/716281

And a side note from PEP 394:

For scripts that are only expected to be run in an activated virtual environment, shebang lines can be written as #!/usr/bin/env python, as this instructs the script to respect the active virtual environment.

I also added a commit which makes main.py executable in the repository, so that we can clone it and do ./main.py instead of having to invoke it through Python or manually chmod +x it after cloning.

rhyst commented 2 years ago

Merged, thanks!