libcalamares: importing the embedded python module can fail
This commit is contained in:
parent
5346008b7a
commit
a629e2650a
@ -240,12 +240,18 @@ Job::exec()
|
|||||||
|
|
||||||
py::scoped_interpreter guard {};
|
py::scoped_interpreter guard {};
|
||||||
// Import, but do not keep the handle lying around
|
// Import, but do not keep the handle lying around
|
||||||
|
try
|
||||||
{
|
{
|
||||||
auto calamaresModule = py::module_::import( "libcalamares" );
|
auto calamaresModule = py::module_::import( "libcalamares" );
|
||||||
calamaresModule.attr( "job" ) = Calamares::Python::JobProxy( this );
|
calamaresModule.attr( "job" ) = Calamares::Python::JobProxy( this );
|
||||||
calamaresModule.attr( "globalstorage" )
|
calamaresModule.attr( "globalstorage" )
|
||||||
= Calamares::Python::GlobalStorageProxy( JobQueue::instance()->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 )
|
if ( s_preScript )
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user