mod_python ignoring shebang and using Python 2 instead of 3 -
i'm trying run script in browser. installed mod_python
running web-based applications on server , set shebang in 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 run script browser (my application), see python version 2. when run script console, using:
python3 index.py
python version 3.3.5 used expected. why mod_python
ignoring shebang?
upd. question closed
- i opted out of mod_python.
- i founded mistake in shebang (i should set \n line endings unix).
- writed wrapper on php running python 3
set executable flag on file:
chmod a+x yourfile.py
then, execute as:
./yourfile.py
Comments
Post a Comment