1

I want to publish Python programs on the web, not execute them. When I put one in my web directory, CGIWrap jumps up and says:

"CGIWrap Error: Execution of this script not permitted"

What configuration can I give to Apache or CGIWrap so that it serves the content of .py files instead of getting into the above?

Aaron Brick
  • 192
  • 8
  • If they have a .py extension, you should probably change that (use .txt or .html, if anything). Likewise, I would consider removing any shebang lines and simply specify they need to be added back. If you're distributing them, wrapping them in a compressed format should help. – Anaksunaman Sep 23 '17 at 08:02

1 Answers1

1

From an answer on how TO execute a python script, I grabbed:

Options +ExecCGI
AddHandler cgi-script .py

This, and a quick trip over to the apache docs (to learn the reverse of AddHandler), leads me to suggest:

Options -ExecCGI
RemoveHandler .py

Let me know if this works for you!

Peter Berbec
  • 188
  • 1
  • 11
  • 1
    This seems like the right approach, but apparently there is an AllowOverride setting upstream that stops me from testing it (i.e., the .htaccess file is not read). I will ask the sysadmin if doing so is the only way forward. – Aaron Brick Sep 24 '17 at 06:45
  • Ah! That's annoying. Any change you can just rename the files to ".py.txt"? – Peter Berbec Sep 25 '17 at 11:41
  • I'm not going to do that, but you put me on the right track. Thanks! – Aaron Brick Sep 26 '17 at 04:59