At Sun, 31 Mar 2019 14:49:04 -0400 David Greenberg <david.greenberg3 at gmail.com> wrote: > > > > Hi All, > I've got it installed and running, but I can't figure out how to make it > the default as far as Apache is concerned. I have an extremely simple > script: > > #!/usr/bin/env python > print ("Content-Type: plain;charset=utf-8\r\n") > print() > > print("Hello World!") > > which runs as a Python 2.7 script as expected after enabling > LoadModule cgi_module libexec/apache2/mod_cgi.so > in https.conf, but if I try to change 'python' to 'python3' I get a 500 > error and the Apache error log says: > > [Sun Mar 31 13:34:38.253331 2019] [cgi:error] [pid 26370] [client > ::1:52412] End of script output before headers: testLocalHost.py > > I tried adding the two lines below in httpd.conf but that just resulted in > the same 500 error. > > LoadModule wsgi_module > /Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/mod_wsgi/server/ > mod_wsgi-py37.cpython-37m-darwin.so > WSGIPythonHome /Library/Frameworks/Python.framework/Versions/3.7 > > I was on the verge of trying this: > > ln -s /Library/Frameworks/Python.framework/Versions/3.7 /usr/bin/python3 > > but since I really don't know what I'm doing, I got cold feet and decided > to ask for help. Thanks. This is one option, but I am guessing it really should be: ln -s /Library/Frameworks/Python.framework/Versions/3.7/python3 /usr/bin/python3 (or something like that, depending on the actual program name, and I'm guessing it isn't "3.7", which is more likely a directory name containing the program, unless the the "3.7" directory contains a whole tree (eg, bin/, lib/, etc.), in which case you would need to include that: ln -s /Library/Frameworks/Python.framework/Versions/3.7/bin/python3 /usr/bin/python3 The other is to just replace '#!/usr/bin/env python' at the top of your scripts with '#!/Library/Frameworks/Python.framework/Versions/3.7/python3' (or whatever is the name of the actual executable, presumable under /Library/Frameworks/Python.framework/Versions/3.7/ -- it could just be python or it might be python3.7 and it is entirely possible any of these (with two already being symlinks). The '#!/usr/bin/env python' hack is great when running from the command line in a shell terminal, but rarely works well otherwise, since the environment for other environments is harder to control or even know what it is. For something like a CGI script running from a webserver it is just better to explicitly and specificly name the executable you want to run. Oh, and the Content-Type: should be "text/plain", not just "plain". > > David > > MIME-Version: 1.0 > > _______________________________________________ > Hidden-discuss mailing list - home page: http://www.hidden-tech.net > Hidden-discuss at lists.hidden-tech.net > > You are receiving this because you are on the Hidden-Tech Discussion list. > If you would like to change your list preferences, Go to the Members > page on the Hidden Tech Web site. > http://www.hidden-tech.net/members > > -- Robert Heller -- 978-544-6933 Deepwoods Software -- Custom Software Services http://www.deepsoft.com/ -- Linux Administration Services heller at deepsoft.com -- Webhosting Services