From fdc2ec2e73c3dc180b35cf4aa4447ff3ab0a3f10 Mon Sep 17 00:00:00 2001 From: David Sansome Date: Sun, 2 Jan 2011 16:09:14 +0000 Subject: [PATCH] Better (read: some) error handling when the clementine module can't be imported --- src/scripting/python/pythonengine.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/scripting/python/pythonengine.cpp b/src/scripting/python/pythonengine.cpp index 09be4fd17..ed5c8318d 100644 --- a/src/scripting/python/pythonengine.cpp +++ b/src/scripting/python/pythonengine.cpp @@ -85,6 +85,14 @@ Script* PythonEngine::CreateScript(const QString& path, // Get the clementine module so we can put stuff in it clementine_module_ = PyImport_ImportModule("clementine"); + if (!clementine_module_) { + AddLogLine("Failed to import the clementine module", true); + if (PyErr_Occurred()) { + PyErr_Print(); + } + Py_Finalize(); + return NULL; + } sip_api_ = GetSIPApi(); // Add objects to the module