libcalamares: importing the embedded python module can fail

This commit is contained in:
Adriaan de Groot 2023-11-07 13:40:10 +01:00
parent 5346008b7a
commit a629e2650a

View File

@ -240,12 +240,18 @@ Job::exec()
py::scoped_interpreter guard {};
// Import, but do not keep the handle lying around
try
{
auto calamaresModule = py::module_::import( "libcalamares" );
calamaresModule.attr( "job" ) = Calamares::Python::JobProxy( this );
calamaresModule.attr( "globalstorage" )
= Calamares::Python::GlobalStorageProxy( JobQueue::instance()->globalStorage() );
}
catch ( const py::error_already_set& e )
{
cError() << "Error in import:" << e.what();
throw; // This is non-recoverable
}
if ( s_preScript )
{