fix [#31597] Operator Preset: Python Warning whenever a preset is executed (seen on Windows)

This commit is contained in:
2012-05-25 14:08:50 +00:00
parent 19705e969a
commit 352cd241a3

View File

@@ -421,9 +421,9 @@ static int python_script_exec(bContext *C, const char *fn, struct Text *text,
fclose(fp);
pystring = MEM_mallocN(strlen(fn) + 32, "pystring");
pystring = MEM_mallocN(strlen(fn) + 36, "pystring");
pystring[0] = '\0';
sprintf(pystring, "exec(open(r'%s').read())", fn);
sprintf(pystring, "f=open(r'%s');exec(f.read());f.close()", fn);
py_result = PyRun_String(pystring, Py_file_input, py_dict, py_dict);
MEM_freeN(pystring);
}