That's what execfile() is for.
http://docs.python.org/library/functions.html#execfile
Create a temporary file.
Write the content of the textbox into the file.
Close.
Execfile.
Delete when done.
That's what execfile() is for.
http://docs.python.org/library/functions.html#execfile
Create a temporary file.
Write the content of the textbox into the file.
Close.
Execfile.
Delete when done.
Python provides number of ways to do this using function calls: - eval() - exec()
For your needs you should read about exec.
Hey, I would be curious if it is possible to read from an user any line of code and then run it from the Compiler?
The idea would be like: code = input() run(code)
and the user would write something like: Terminal: Enter a line of code: print(1+1)
the result would be 2
Thank you
Visual Studio Code - input function in Python - Stack Overflow
Pause a running python script and resume when necessary.
Python launcher runs code and immediately closes
you can add 'raw_input()' in the end - it will wait for a user input and will not close the window, untill you press enter
also have a look on Sublime Text 2 - it is a great text editor itself and have some IDE features
open you python code in it, press ctrl+b - it wil run the script and show you a console. you do not need raw_input() in this case
More on reddit.comNever trust user input, remote code execution due to insecure deserialization
...This is like a JWT without the security hash, that guarantees the payload hasn't been tampered with.
It is fine the data is exposed, but you salt the data with a secret and hash it. You send the data and the hash. Then you forget about it, until it comes back. Then you recreate the hash and if the hash you made right then and there matches the hash you seem to have made previously-- then you can trust that your client side "session data" can somewhat be trusted.
So, I guess the real moral of the story is don't do client side session management without a verification mechanism. ...Or at least an obfuscation mechanism.
More on reddit.comTasks are intended for building your application. Since Python is interpreted, you don't need to use tasks.json at all to run/debug your Python code. Use the launch.json instead. I am using Don Jayamanne's Python extension for debugging and have configured the launch.json as follows:
Open the Command Palette (Ctrl + Shift + P) and write the command:
start without debugging
Then select your Environment -> Click Python. This should create a launch.json file within a .vscode directory in the current directory.
Paste the following configuration json
{ "version": "0.2.0", "configurations": [ { "name": "Python", "type": "python", "request": "launch", "stopOnEntry": true, "pythonPath": "${config.python.pythonPath}", "program": "${file}", "debugOptions": [ "WaitOnAbnormalExit", "WaitOnNormalExit", "RedirectOutput" ], "console": "integratedTerminal" } ]}Save the file, open your python script in the editor and 'start without debugging' again. This should launch an integrated terminal where you can give input as well as see the output.
Ctrl+Shift+d, then choose integrated terminal/console.
