Ability to make Python runnable code blocks #96
limitcracker
started this conversation in
Ideas
Replies: 1 comment 2 replies
|
Hi @limitcracker, Thanks for your message. That sounds like a great use case! Here’s a basic example of how it could work: 🐍 Python block (exercise)```python blockName=py;
print("Hello from Python")🧠 Custom JS function to run Pythonasync function runPy(sourceCode) {
_fs.writeFileSync(__dirname + 'pyscript-example.py', sourceCode);
const { stdout, stderr } = await exec(`python3 "${__dirname}pyscript-example.py"`);
console.log(stdout);
}
|
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
I would like to make some python blocks as exercises to my students. Below or in another file to have test cases for those exercises that will provide score to the student. Can this be done with the current versions or needs tweak for python runnable blocks?
All reactions