id,summary,reporter,owner,description,type,status,milestone,component,version,severity,resolution,keywords,cc 11024,exec_file raises error if run in loop,edward.terhaar@…,Ralf W. Grosse-Kunstleve,"We tried to run a soak test of our code which uses boost::python, but found that after 509 runs the file could not be read. Found the cause to be boost::python not closing the FILE after an fopen. Line 91 in exec.cpp. Adding fclose(fs) after PyRun_File seemed to fix the problem. You can reproduce the problem with the following code: {{{ int _tmain(int argc, _TCHAR* argv[]) { int count = 0; Py_Initialize(); while (true) { auto strScriptFile = ""D:\\Scrap\\ConsoleApplication2\\SampleCustomMacroOne.py""; object main_module = import(""__main__""); dict globalDict = extract(main_module.attr(""__dict__"")); exec_file(strScriptFile, globalDict); std::cout << count << endl; count++; } return 0; } }}}",Bugs,closed,To Be Determined,python USE GITHUB,Boost 1.55.0,Problem,duplicate,file loop python script,