0

I have written a python console based program. It takes few arguments (like file name ) for execution. I want to run it from the browser... How can I parse this arguments and execute that python code Any clues..approaches. Thanks

4
  • 1
    Execute Python just like Javascript in a browser? If that's what you mean, that's not possible... But there is an interesting Python to Javascript compiler. Commented Dec 1, 2011 at 18:03
  • @JohnDoe: I am trying that out.. but I am facing a weird problem.. Its example scripts run just fine.. but then if i use its library in a program... then the is some python-hulahop which it says is missing and I am not able to find it anywhere for ubuntu.. :( Commented Dec 1, 2011 at 18:08
  • How about Skulpt? Although, Pyjamas still looks like the best bet... Commented Dec 1, 2011 at 18:15
  • And if what you meant was more like a server side Python application, I use Django for that. But client side Python scripting isn't really feasible. :) Commented Dec 1, 2011 at 18:23

1 Answer 1

2

Maybe you should clarify your problem. At least i don't fully understand why you want to run a terminal program in the browser?

But if you want to reuse some code you have already written you could use a micro framework like Flask.

Check this example from flask's docs:

from flask import Flask
app = Flask(__name__)

@app.route("/")
def hello():
    return "Hello World!"

if __name__ == "__main__":
    app.run()

So you could write a simple view that accepts the arguments you need and the view would then call your code and return whatever you want, most likely an http response.

Sign up to request clarification or add additional context in comments.

2 Comments

sweeet.. exactly what i needed :)
wow..this thing is light weight and pretty straightforward :)

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.