Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit fd91846

Browse files
committedMar 18, 2019
correctly close files executed from QgsPythonRunner
1 parent b0024dc commit fd91846

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed
 

‎src/app/main.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1387,7 +1387,7 @@ int main( int argc, char *argv[] )
13871387
//replace backslashes with forward slashes
13881388
pythonfile.replace( '\\', '/' );
13891389
#endif
1390-
QgsPythonRunner::run( QStringLiteral( "exec(open('%1').read())" ).arg( pythonfile ) );
1390+
QgsPythonRunner::run( QStringLiteral( "with open('%1','r') as f: exec(f.read())" ).arg( pythonfile ) );
13911391
}
13921392

13931393
/////////////////////////////////`////////////////////////////////////

0 commit comments

Comments
 (0)
Please sign in to comment.