Forums

Command line parameters with embedded editor

Just wondering... Can I set and run Python command line parameters (sys.argv) via the built-in editor using the ">>>" button?

Thanks!

I don't think so.

However, if you keep a bash console open, then you can type "yourfile.py param". Alt-Tab, up arrow, enter...

I knocked up a little Chrome extension a while ago that ran my script in an adjacent bash console because it was simply much, much faster than waiting for a new console to spin-up. I might be able to dig it up, if that's helpful.

..

..

sure! that sounds interesting

Thanks for the response.

Since there does not appear to be a way to setup command line arguments in the PythonAnywhere online editor, I found two other solutions that work okay. Both solutions require keeping two browser tabs open - one for the editor and one for the console.

(1) The first is to run python3.4 with my Python program and all of its arguments from the bash console. I can then edit the arguments using command line history.

(2) The second is to create a short bash script that runs python3.4 with my Python program and all of its arguments. I can change the arguments in the bash script using the PythonAnywhere online editor.