#πŸ”’ Compile/Interpret different programming languages

8 messages Β· Page 1 of 1 (latest)

marble sleet
#

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.

onyx violetBOT
#

@marble sleet

Python help channel opened

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.

slim pendant
#

You'd use the subprocess module to run the appropriate interpreters/compiles.

marble sleet
slim pendant
#

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/

In this tutorial, you'll learn how to leverage other apps and programs that aren't Python, wrapping them or launching them from your Python scripts using the subprocess module. You'll learn about processes all the way up to interacting with a process as it executes.

marble sleet
#

I'm kinda in a hurry to make this is it possible to get some code that does it? Sorry for the inconveinence πŸ˜…

onyx violetBOT
#
Python help channel closed

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.