I've done this before but I can't seem to find the file, basically what I wanna do is be able to specify a file path of any programming language in a variable (e.g. path = "path") and run it. I want to be able to get any errors if there are any. I've done this before and tested it with a ruby .rb file and it worked. As far as I remember it only had 5 - 10 lines max.
#π Compile/Interpret different programming languages
8 messages Β· Page 1 of 1 (latest)
@marble sleet
Remember to:
- Ask your Python question, not if you can ask or if there's an expert who can help.
- Show a code sample as text (rather than a screenshot) and the error message, if you've got one.
- Explain what you expect to happen and what actually happens.
:warning: Do not pip install anything that isn't related to your question, especially if asked to over DMs.
Closes after a period of inactivity, or when you send !close.
You'd use the subprocess module to run the appropriate interpreters/compiles.
Hey, thanks for responding
I'm pretty new to python/havent used python in a very long time, is it possible to get some code for it?
The docs are pretty in-depth: https://docs.python.org/3/library/subprocess.html
And Real Python has a whole article on the module: https://realpython.com/python-subprocess/
Python documentation
Source code: Lib/subprocess.py The subprocess module allows you to spawn new processes, connect to their input/output/error pipes, and obtain their return codes. This module intends to replace seve...
I'm kinda in a hurry to make this is it possible to get some code that does it? Sorry for the inconveinence π
This help channel has been closed and it's no longer possible to send messages here. If your question wasn't answered, feel free to create a new post in #1035199133436354600. To maximize your chances of getting a response, check out this guide on asking good questions.