Author: ajborley
Date: Mon Nov 20 04:01:03 2006
New Revision: 477156
URL: http://svn.apache.org/viewvc?view=rev&rev=477156
Log:
Python2.5 does not seem to like module paths that end with '/' - now fixed
Modified:
incubator/tuscany/cpp/sca/runtime/extensions/python/src/tuscany/sca/python/PythonServiceWrapper.cpp
Modified:
incubator/tuscany/cpp/sca/runtime/extensions/python/src/tuscany/sca/python/PythonServiceWrapper.cpp
URL:
http://svn.apache.org/viewvc/incubator/tuscany/cpp/sca/runtime/extensions/python/src/tuscany/sca/python/PythonServiceWrapper.cpp?view=diff&rev=477156&r1=477155&r2=477156
==============================================================================
---
incubator/tuscany/cpp/sca/runtime/extensions/python/src/tuscany/sca/python/PythonServiceWrapper.cpp
(original)
+++
incubator/tuscany/cpp/sca/runtime/extensions/python/src/tuscany/sca/python/PythonServiceWrapper.cpp
Mon Nov 20 04:01:03 2006
@@ -82,15 +82,19 @@
throwException(SystemConfigurationException, msg.c_str());
}
- loginfo("Module: %s", impl->getModule().c_str());
- loginfo("Path: %s", impl->getModulePath().c_str());
- loginfo("Class: %s", impl->getClass().c_str());
-
// Initialize the Python environment
Py_Initialize();
// Add the path to the composite (+ any further path
specified) to the Python sys.path
- string path = component->getComposite()->getRoot() + "/" +
impl->getModulePath();
+ string path = component->getComposite()->getRoot();
+ if(impl->getModulePath().size() > 0)
+ {
+ path += "/" + impl->getModulePath();
+ }
+
+ loginfo("Module: %s", impl->getModule().c_str());
+ loginfo("Path: %s", path.c_str());
+ loginfo("Class: %s", impl->getClass().c_str());
PyObject* pSysName = PyString_FromString("sys");
PyObject* pSys = PyImport_Import(pSysName);
@@ -104,8 +108,7 @@
{
PyObject* pPath = PyString_FromString(path.c_str());
PyList_Append(pSysPath, pPath);
-
-
+
Py_DECREF(pPath);
Py_DECREF(pSysPath);
}
@@ -127,7 +130,7 @@
{
PyErr_Print();
}
- string msg = "Failed to load module named " +
impl->getModule();
+ string msg = "Failed to load module named " +
impl->getModule() + " on path " + path;
throwException(SystemConfigurationException, msg.c_str());
}
//else
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]