Skip to content
Permalink
Browse files

correctly close files executed from QgsPythonRunner

  • Loading branch information
volaya authored and nyalldawson committed Mar 18, 2019
1 parent 1b79513 commit a8078a2db13f6625e7f2e7631f8bfac3f884fa68
Showing with 1 addition and 1 deletion.
  1. +1 −1 src/app/main.cpp
@@ -1387,7 +1387,7 @@ int main( int argc, char *argv[] )
//replace backslashes with forward slashes
pythonfile.replace( '\\', '/' );
#endif
QgsPythonRunner::run( QStringLiteral( "exec(open('%1').read())" ).arg( pythonfile ) );
QgsPythonRunner::run( QStringLiteral( "with open('%1','r') as f: exec(f.read())" ).arg( pythonfile ) );
}

/////////////////////////////////`////////////////////////////////////

0 comments on commit a8078a2

Please sign in to comment.
You can’t perform that action at this time.