1

I made test.py and ran chmod u+x test.py. It works if I run python test.py but not ./test.py. What am I doing wrong?

./test.py: line 1: syntax error near unexpected token `"HelloWorld"'
./test.py: line 1: `print ("HelloWorld")'
John Kugelman
  • 349,597
  • 67
  • 533
  • 578
Wonjae
  • 23
  • 3
  • Try adding `#!/usr/bin/env python` as the first line of your Python file. See [here](https://stackoverflow.com/questions/2429511/why-do-people-write-the-usr-bin-env-python-shebang-on-the-first-line-of-a-pyt) for more info. – bkerivan Oct 06 '19 at 16:06
  • please show your source code for your script as well – Josh Weinstein Oct 06 '19 at 16:09

0 Answers0