From: ouv Date: Thu, 30 Apr 2009 07:28:18 +0000 (+0000) Subject: Fix of bug IPAL21005 - Dump/load python script works only with absolute path X-Git-Tag: V4_1_0_maintainance_FINAL~18 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=413daa2e42a01d5c33ed2bc5cf41b743d31ca2a4;p=modules%2Fgui.git Fix of bug IPAL21005 - Dump/load python script works only with absolute path --- diff --git a/src/SalomeApp/SalomeApp_Application.cxx b/src/SalomeApp/SalomeApp_Application.cxx index 54a4ce85c..ad7b6314f 100644 --- a/src/SalomeApp/SalomeApp_Application.cxx +++ b/src/SalomeApp/SalomeApp_Application.cxx @@ -785,7 +785,10 @@ void SalomeApp_Application::onLoadScript( ) if ( !aFile.isEmpty() ) { - QString command = QString("execfile(\"%1\")").arg(aFile); + QFileInfo aFileInfo( aFile ); + QString anAbsPath = aFileInfo.dirPath( true ); + QString aFileName = aFileInfo.baseName(); + QString command = QString("import sys; sys.path.insert(0,\"%1\"); import %2").arg(anAbsPath, aFileName); PythonConsole* pyConsole = pythonConsole();