0

I have read through already answered similar questions such as this. I have been facing similar issue in my modules. However, when I make the python script executable with chmod and copy it to /usr/local/bin, I can run the script by calling its name. What changes when I make it executable? Why doesn't it work otherwise?

Chinmay Bhoir
  • 11
  • 1
  • 2

1 Answers1

0

I found the answer.

My python script was compatible with python 3, but not python 2. When I ran with python 2 (i.e. by command python), it throws AttributeError. The script works when made executable because of #!/usr/bin/env python3 in my script, telling the shell which interpreter to use.

Chinmay Bhoir
  • 11
  • 1
  • 2