Skip to content

Commit

Permalink
Only require qgis.gui import when gui is built
Browse files Browse the repository at this point in the history
  • Loading branch information
m-kuhn authored and nyalldawson committed Aug 29, 2024
1 parent 8e3ab39 commit 5668207
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/python/qgspythonutilsimpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,11 @@ def run_startup_script(script_path):

// import QGIS bindings
QString error_msg = QObject::tr( "Couldn't load PyQGIS." ) + '\n' + QObject::tr( "Python support will be disabled." );
if ( !runString( QStringLiteral( "from qgis.core import *" ), error_msg ) || !runString( QStringLiteral( "from qgis.gui import *" ), error_msg ) )
if ( !runString( QStringLiteral( "from qgis.core import *" ), error_msg )
#ifdef HAVE_GUI
|| !runString( QStringLiteral( "from qgis.gui import *" ), error_msg )
#endif
)
{
return false;
}
Expand Down

0 comments on commit 5668207

Please sign in to comment.