mirror of
https://github.com/qgis/QGIS.git
synced 2025-03-03 00:02:25 -05:00
correctly close files executed from QgsPythonRunner
This commit is contained in:
parent
1ab7925983
commit
7653e45321
@ -1390,7 +1390,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 ) );
|
||||
}
|
||||
|
||||
/////////////////////////////////`////////////////////////////////////
|
||||
|
Loading…
x
Reference in New Issue
Block a user