0

Short and sweet version: I figured breaking it down into steps would make it easier.

  1. I'm building a website

  2. I hate SQL. It makes no sense to me, for a programmer to have to learn an additional language for database interaction.

  3. I can't stand PHP: It's too much like C and doesn't integrate well with MongoDB

  4. I LOVE Python: It's simple, straight-forward, and integrates well with MongoDB

  5. Python isn't built for the web: Ideally, Python would use this feature <?python?>, like PHP.

  6. To counter number 5, I've written an interpreter (in Python) which reads a file line by line and prints everything until it finds <?python. Upon finding that, it starts executing Python code until it hits ?>. Then it will resume printing the HTML lines in the file.

I've setup my CGI file to point to my new interpreter with this line:

#!/home/jesse/Desktop interpret

The interpreter itself has a shebang line:

#!/usr/bin/env python3

Upon execution of the CGI file, I get:

bash: ./test: /home/jesse/Desktop: bad interpreter: Permission denied

How can I fix this problem? Are there any better ways of optimizing my scripts (besides my interpreter)?

3
  • /home/jesse/Desktop looks like a folder.
    – muru
    Dec 11, 2014 at 9:37
  • It is. I figured out what I was doing wrong. It's OK to put a space between /usr/bin/env and python but everything else needs a / between it. So /home/jesse/Desktop/interpret
    – KI4JGT
    Dec 11, 2014 at 9:41
  • /usr/bin/env is a command, and python is an argument you pass to it. That's why you can put a space there. You could do /usr/bin/env interpret if interpret is in the PATH.
    – muru
    Dec 11, 2014 at 9:43

1 Answer 1

1

I found out what was wrong.

#!/home/jesse/Desktop interpret

Needed to be:

#!/home/jesse/Desktop/interpret

/usr/bin/env is a command itself. Python is an argument passed to it.

Thanks to @muru for this.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .