Skip to content

Commit 50fd2b1

Browse files
committed
Fixed error in executing python file at start.
This exec form should be compatible with both py2 and py3
1 parent efd32ff commit 50fd2b1

File tree

1 file changed

+1
-4
lines changed

1 file changed

+1
-4
lines changed

src/app/main.cpp

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1145,10 +1145,7 @@ int main( int argc, char *argv[] )
11451145
//replace backslashes with forward slashes
11461146
pythonfile.replace( '\\', '/' );
11471147
#endif
1148-
QFile f( pythonfile );
1149-
QTextStream in( &f );
1150-
QgsPythonRunner::run( QString( "code = compile('%1', '%2', 'exec')" ).arg( in.readAll(), pythonfile ) );
1151-
QgsPythonRunner::run( QString( "exec(code, global_vars, local_vars)" ) );
1148+
QgsPythonRunner::run( QString( "exec(open('%1').read())" ).arg( pythonfile ) );
11521149
}
11531150

11541151
/////////////////////////////////`////////////////////////////////////

0 commit comments

Comments
 (0)