I'm trying to run a script in the browser. I installed mod_python
for running web-based applications on the server and set a shebang in my script:
#!/usr/bin/env python3
# -*- coding: UTF-8 -*-
import sys
def index():
print ("Content-type: text/html\n")
print('Version Python {0}'.format(sys.version_info[0]))
if __name__ == '__main__':
index()
However, when I run my script from the browser (my application), I see that the Python version is 2. When I run the script from the console, using:
python3 index.py
Python version 3.3.5 is used as expected. Why is mod_python
ignoring the shebang?
UPD. The Question closed
- I opted out of the mod_python.
- I founded a mistake in shebang (I should set \n line endings for Unix).
- Writed wrapper on php for running python 3
./myscriptname.py
raise errorNo such file or directory
– Artem Chernov Sep 21 '15 at 10:35