Skip to content

Commit 7653e45

Browse files
volayanyalldawson
authored andcommitted
correctly close files executed from QgsPythonRunner
1 parent 1ab7925 commit 7653e45

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/app/main.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -1390,7 +1390,7 @@ int main( int argc, char *argv[] )
13901390
//replace backslashes with forward slashes
13911391
pythonfile.replace( '\\', '/' );
13921392
#endif
1393-
QgsPythonRunner::run( QStringLiteral( "exec(open('%1').read())" ).arg( pythonfile ) );
1393+
QgsPythonRunner::run( QStringLiteral( "with open('%1','r') as f: exec(f.read())" ).arg( pythonfile ) );
13941394
}
13951395

13961396
/////////////////////////////////`////////////////////////////////////

0 commit comments

Comments
 (0)