dudu dudu - 3 months ago 6x
Python Question

file sourcing within cgi failed

My cgi file:

#!/bin/sh -f
source /Users/sfma/sastbx/build/setpaths_all.sh
python processQuery.py

Then "Internal Server Error" arises. I checked the error_log, and it says:

[Thu Jun 23 15:02:39.809441 2016] [cgi:error] [pid 1327] [client ::1:52131] AH01215: /Users/sfma/sastbx/build/bin/libtbx.path_utility: line 63: /Users/sfma/sastbx/build/../../Library/Enthought/Canopy_64bit/User/bin/python: Permission denied: /Library/WebServer/CGI-Executables/web.cgi, referer: http://localhost/modelRetrieval/query.html

Remove the
statement, it works fine. But I need to source this file for further use.


According to the error message, I think the error may be due to the python permission.

#!/bin/sh -f
#python processQuery.py #this works fine
/Users/sfma/Library/Enthought/Canopy_64bit/User/bin/python processQuery.py #this does not work. Permission denied.

This really puzzles me because
is exactly the python I'm using:

$which python


I finally solved this problem.

Since python works fine while /Users/sfma/Library/Enthought/canopy_64bit/User/bin/python leads to a problem, I hard coded some variables in files libtbx.path_utility and sastbx.python to "python" instead of what they used to be: "/Users/sfma/sastbx/build/../../Library/Enthought/canopy_64bit/User/bin/python"

The reason why /Users/sfma/Library/Enthought/Canopy_64bit/User/bin/python is permission denied is that _www is now allowed to visit my Library folder. Check this. After making that directory available to all, this problem is finally solved.