@@ -4773,33 +4773,38 @@ void QgisApp::loadPythonSupport()
4773
4773
#ifdef __MINGW32__
4774
4774
pythonlibName.prepend ( " lib" );
4775
4775
#endif
4776
- QLibrary pythonlib ( pythonlibName );
4776
+ QString version = QString (" %1.%2.%3" ).arg ( QGis::QGIS_VERSION_INT / 10000 ).arg ( QGis::QGIS_VERSION_INT / 100 % 100 ).arg ( QGis::QGIS_VERSION_INT % 100 );
4777
+ QgsDebugMsg ( QString (" load library %1 (%2)" ).arg ( pythonlibName ).arg ( version ) );
4778
+ QLibrary pythonlib ( pythonlibName, version );
4777
4779
// It's necessary to set these two load hints, otherwise Python library won't work correctly
4778
4780
// see http://lists.kde.org/?l=pykde&m=117190116820758&w=2
4779
4781
pythonlib.setLoadHints ( QLibrary::ResolveAllSymbolsHint | QLibrary::ExportExternalSymbolsHint );
4780
- if ( pythonlib.load () )
4782
+ if ( ! pythonlib.load () )
4781
4783
{
4782
- // QgsDebugMsg("Python support library loaded successfully.");
4783
- typedef QgsPythonUtils*( *inst )();
4784
- inst pythonlib_inst = ( inst ) cast_to_fptr ( pythonlib.resolve ( " instance" ) );
4785
- if ( pythonlib_inst )
4786
- {
4787
- // QgsDebugMsg("Python support library's instance() symbol resolved.");
4788
- mPythonUtils = pythonlib_inst ();
4789
- mPythonUtils ->initPython ( mQgisInterface );
4790
- }
4791
- else
4784
+ // using stderr on purpose because we want end users to see this [TS]
4785
+ QgsDebugMsg ( " Couldn't load Python support library: " + pythonlib.errorString () );
4786
+ pythonlib.setFileName ( pythonlibName );
4787
+ if ( !pythonlib.load () )
4792
4788
{
4793
- // using stderr on purpose because we want end users to see this [TS]
4794
- QgsDebugMsg ( " Couldn't resolve python support library's instance() symbol. " ) ;
4789
+ qWarning ( " Couldn't load Python support library: %s " , pythonlib. errorString (). toUtf8 (). data () );
4790
+ return ;
4795
4791
}
4796
4792
}
4797
- else
4793
+
4794
+ // QgsDebugMsg("Python support library loaded successfully.");
4795
+ typedef QgsPythonUtils*( *inst )();
4796
+ inst pythonlib_inst = ( inst ) cast_to_fptr ( pythonlib.resolve ( " instance" ) );
4797
+ if ( !pythonlib_inst )
4798
4798
{
4799
4799
// using stderr on purpose because we want end users to see this [TS]
4800
- QgsDebugMsg ( " Couldn't load Python support library: " + pythonlib.errorString () );
4800
+ QgsDebugMsg ( " Couldn't resolve python support library's instance() symbol." );
4801
+ return ;
4801
4802
}
4802
4803
4804
+ // QgsDebugMsg("Python support library's instance() symbol resolved.");
4805
+ mPythonUtils = pythonlib_inst ();
4806
+ mPythonUtils ->initPython ( mQgisInterface );
4807
+
4803
4808
if ( mPythonUtils && mPythonUtils ->isEnabled () )
4804
4809
{
4805
4810
QgsPluginRegistry::instance ()->setPythonUtils ( mPythonUtils );
@@ -4811,7 +4816,6 @@ void QgisApp::loadPythonSupport()
4811
4816
mActionPluginSeparator2 = mPluginMenu ->addSeparator ();
4812
4817
mPluginMenu ->addAction ( mActionShowPythonDialog );
4813
4818
std::cout << " Python support ENABLED :-) " << std::endl; // OK
4814
-
4815
4819
}
4816
4820
}
4817
4821
0 commit comments