My python version is
Python 2.7.12 (default, Nov 20 2017, 18:23:56) [GCC 5.4.0 20160609] on linux2 Type "help", "copyright", "credits" or "license" for more information.
This is my python script:
def main(): print " Generating Initial data" if __name__ == '__main__': main() If i run it as,
/test$ python gen_in_data.py Generating Initial data it is working fine.
But if I run it as ,
/test$ ./gen_in_data.py ./gen_in_data.py: line 1: syntax error near unexpected token `(' ./gen_in_data.py: line 1: `def main():' it is throwing this error. Please let me know the issue.
/usr/bin/env pythonor less commonly a hardcoded path like/usr/local/bin/python. (I'm sure this is a dup of an existing question, which will have a more detailed answer that explains things better… just let me find it.)