Skip to content
Snippets Groups Projects
Commit 804f26f1 authored by Francois Keith's avatar Francois Keith
Browse files

Correct the PyRun_File use. Close the file once finished. Solves error pointed in previous commit.

parent 4e4d7eef
No related branches found
No related tags found
No related merge requests found
...@@ -230,8 +230,8 @@ PyObject* Interpreter::globals() ...@@ -230,8 +230,8 @@ PyObject* Interpreter::globals()
void Interpreter::runPythonFile( std::string filename ) void Interpreter::runPythonFile( std::string filename )
{ {
PyObject* pymainContext = globals_; PyObject* pymainContext = globals_;
PyRun_File(fopen( filename.c_str(),"r" ), filename.c_str(), PyRun_FileExFlags(fopen( filename.c_str(),"r" ), filename.c_str(),
Py_file_input, pymainContext,pymainContext); Py_file_input, pymainContext,pymainContext, true, NULL);
if (PyErr_Occurred()) if (PyErr_Occurred())
{ {
std::cout << "Error occures..." << std::endl; std::cout << "Error occures..." << std::endl;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment