diff --git a/HLT/Trigger/TrigControl/TrigPSC/src/Psc.cxx b/HLT/Trigger/TrigControl/TrigPSC/src/Psc.cxx index 253b3a16cd1340ddeb5d57cf200a20049a52fb81..e0d42c867ee2350765935515f5a85aa156f299da 100644 --- a/HLT/Trigger/TrigControl/TrigPSC/src/Psc.cxx +++ b/HLT/Trigger/TrigControl/TrigPSC/src/Psc.cxx @@ -506,10 +506,12 @@ bool psc::Psc::prepareForRun (const ptree& args) return false; } - // After prepareForRun the HLTMPPU will fork the workers. Tell the Python - // interpreter this is happening to avoid deadlocks (ATR-23428). - ERS_DEBUG(1, "Pre-fork initialization of Python interpreter"); - PyOS_BeforeFork(); + if ( Py_IsInitialized() ) { + // After prepareForRun the HLTMPPU will fork the workers. Tell the Python + // interpreter this is happening to avoid deadlocks (ATR-23428). + ERS_DEBUG(1, "Pre-fork initialization of Python interpreter"); + PyOS_BeforeFork(); + } return true; }