Forums

Run python script WITHOUT uploading it into Pythonanywhere?

Hi, I'm not really new to Python, but I am new to Pythonanywhere and front end in general.

Can I somehow "run" my python script from my machine WITHOUT actually uploading the script into Pythonanywhere? Meaning, the actual script stays on my machine, but Pythonanywhere just connects to it somehow and runs it remotely?

IOW, for a variety of reasons, we do not want to actually upload our script into Pythonanywhere, so if it's possible to "run" our script directly from my machine, we would like to do that.

Please let me know if that is possible, and if so, how.

Thank you so much!

PythonAnywhere isn't required to run Python on your own machine, you can just install Python and run the file locally.

It sounds like you would benefit more from running your own code on your own machine if that level of security is something you need. Consider getting a Raspberry Pi or something.

Thank you for your reply Markimus. I can obviously run Python on my own machine, and it's also obvious that Pythonanywhere is not required to run python from my machine. My question was whether it's possible to keep the actual code on my machine but somehow have Pythonanywhere run it remotely without copying the code into Pythonanywhere's server. Is there an answer to my actual question? An answer of no would also be acceptable, I am already a paying customer and plan to remain as one regardless of the answer. Thanks.

Thank you for explaining. Short answer: no.

Long answer:

if PythonAnywhere is able to read your script, then it's ultimately going to be an issue regardless of whether or not it's hosted on their file system.

Either it's hosted on their file system and your script is being read directly, or you have some buffer script reading it from some external source; because PythonAnywhere still has access to the information in order to be able to read from that external source, it's not really any more secure to do it this way.

Thanks for the excellent answer, @Markimus! That's just what I would have said myself. Ultimately, in order to run something, our servers need the code. So it will wind up being uploaded one way or the other.

Thinking about this some more, you might be able to find a compiler that compiles the code into something that's not the original source code, removing comments, replacing the variable names, minifying the code, making it hard to see what the code is doing etc.

You can then upload and have PythonAnywhere run that file instead of your original source file.

That obfuscation is about the best you can do here though.

One can minify and uglyfy the code but it can be undone.