Skip to content
Permalink
Browse files

Fixed error in executing python file at start.

This exec form should be compatible with both py2 and py3
  • Loading branch information
elpaso committed Jun 2, 2016
1 parent efd32ff commit 50fd2b1591ee36d35979feb97a3053e7905a6744
Showing with 1 addition and 4 deletions.
  1. +1 −4 src/app/main.cpp
@@ -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 ) );
}

/////////////////////////////////`////////////////////////////////////

0 comments on commit 50fd2b1

Please sign in to comment.
You can’t perform that action at this time.