Skip to content

Commit

Permalink
Fixed error in executing python file at start.
Browse files Browse the repository at this point in the history
This exec form should be compatible with both py2 and py3
  • Loading branch information
elpaso committed Jun 2, 2016
1 parent efd32ff commit 50fd2b1
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions src/app/main.cpp
Expand Up @@ -1145,10 +1145,7 @@ int main( int argc, char *argv[] )
//replace backslashes with forward slashes
pythonfile.replace( '\\', '/' );
#endif
QFile f( pythonfile );
QTextStream in( &f );
QgsPythonRunner::run( QString( "code = compile('%1', '%2', 'exec')" ).arg( in.readAll(), pythonfile ) );
QgsPythonRunner::run( QString( "exec(code, global_vars, local_vars)" ) );
QgsPythonRunner::run( QString( "exec(open('%1').read())" ).arg( pythonfile ) );
}

/////////////////////////////////`////////////////////////////////////
Expand Down

0 comments on commit 50fd2b1

Please sign in to comment.