0

I can't find relevant information about this. For lua, if you want to execute a test.lua file from the main() C function, you call lua_dofile("test.lua"). What is the python equivalent?

2 Answers 2

2

If you are embedding Python, use PyRun_SimpleFile:

FILE *fp = fopen("test.py", "r");
int ret = PyRun_SimpleFile(fp, "test.py");
if(ret < 0) {
    /* exception occurred */
}
Sign up to request clarification or add additional context in comments.

Comments

1

Please look at the manual page for exec - there are a variety of options to execute a program/script. System could also be an alternative.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.