You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I built Sofa on Windows (I took the master branch for the Sofa sources) and I tried to add the SofaPython3 plugin. When I tried via the Plugin Manager, this warning appeared on my terminal and Sofa crashed :
[WARNING] [PythonEnvironment] No python dir found in E:/sofa/build/bin
Indeed, the plugin is in the folder : E:/sofa/build/bin/Release and with the help of Damien, we saw that the problem came from the following function in PythonEnvironment.cpp :
void PythonEnvironment::addPythonModulePathsForPluginsByName(const std::string& pluginName)
{
std::map<std::string, Plugin>& map = PluginManager::getInstance().getPluginMap();
for( const auto& elem : map)
{
Plugin p = elem.second;
if ( p.getModuleName() == pluginName )
{
std::string pluginLibraryPath = elem.first;
// moduleRoot should be 2 levels above the library (plugin_name/lib/plugin_name.so)
std::string moduleRoot = FileSystem::getParentDirectory(FileSystem::getParentDirectory(pluginLibraryPath));
addPythonModulePathsForPlugins(moduleRoot);
return;
}
}
msg_warning("PythonEnvironment") << pluginName << " not found in PluginManager's map.";
}
It seems logical to have this warning because the function uses twice getParentDirectory and as a consequence, from E:/sofa/build/bin/Release/SofaPython3.dll we go to E:/sofa/build/bin, where there is no python3 dir.
We changed the source code and more precisely the file PythonEnvironment.cpp by adding a third getParentDirectory. Thus the line is now :
With that in mind, we added a PYTHONPATH like this : E:/sofa/build/python3/site-packages. With those changes, it seems to work but my question is : is this an error from the source code to not be able to add the plugin from the plugin manager, or is this more a problem with CMake with a Windows distribution that put some files or folders in a place where it should not be during the compilation?
The text was updated successfully, but these errors were encountered:
I built Sofa on Windows (I took the master branch for the Sofa sources) and I tried to add the SofaPython3 plugin. When I tried via the Plugin Manager, this warning appeared on my terminal and Sofa crashed :
Indeed, the plugin is in the folder :
E:/sofa/build/bin/Release
and with the help of Damien, we saw that the problem came from the following function in PythonEnvironment.cpp :It seems logical to have this warning because the function uses twice
getParentDirectory
and as a consequence, fromE:/sofa/build/bin/Release/SofaPython3.dll
we go toE:/sofa/build/bin
, where there is no python3 dir.We changed the source code and more precisely the file PythonEnvironment.cpp by adding a third
getParentDirectory
. Thus the line is now :std::string moduleRoot = FileSystem::getParentDirectory(FileSystem::getParentDirectory(FileSystem::getParentDirectory(pluginLibraryPath)));
With that in mind, we added a
PYTHONPATH
like this :E:/sofa/build/python3/site-packages
. With those changes, it seems to work but my question is : is this an error from the source code to not be able to add the plugin from the plugin manager, or is this more a problem with CMake with a Windows distribution that put some files or folders in a place where it should not be during the compilation?The text was updated successfully, but these errors were encountered: