I need to load a third-party python script into memory and then execute it as as if it was on the command line, similar to how in PowerShell you can do iex(new-object net.webclient).downloadstring("http://<my ip>/myscript.ps1") then invoke it.
For example, I'd like to have my test.py on a web server then locally download and execute it in memory with command line switches, something like:
load("http://<ip>/test.py")
exec("test.py -arg1 value -arg2 value")
I appreciate this is quite naive but any help is appreciated, thanks!
python myscript.py?exec("python test.py -arg1 value -arg2 value"), I need to achieve that without test.py being written out. If test.py does IO that's fine.subprocessto execute the file, this would handle the args etc. It's interesting to think about though...