On Windows, Python 2.6.4 is automatically installed with Softimage 2011. You don’t need to install Python or pywin32 yourself, unless you need to use a different version of Python.
If you need to use a different version of Python, then you can turn off the Use Python installed with Softimage preference.
That’s wonderful, but out of curiosity what happens if we want to install a third party Python library? Is there a subfolder somewhere we can install them to?
There is a site-packages folder inside the Softimage python install folder:
C:\Program Files\Autodesk\Softimage 2011\Application\python\Lib\site-packages
If i have c++ plugin with embedded python, do i have to set something special in order to use python c api functions.
At the moment softimage does not load the plig-in.
Don’t know, that’s not something I’ve tried before.
The plugin doesn’t load into Softimage? Do any of its callbacks get called? eg XSILoadPlugin …
C++ plug-in contains for example:
#include
class EmbeddedPython {
public:
EmbeddedPython (){}
~EmbeddedPython (){}
static void initEmbeddedPython();
}
and initEmbeddedPython implementation:
void EmbeddedPython::initEmbeddedPython(){
Py_Initialize();
PyRun_SimpleString(“print ‘TEST'”);
}
project settings are pointed to python installed automatically with Softimage 2012.
On run Softimage 2012 ,XSILoadPlugin is not called and the plugin is not loaded.
Then if i reload plugin from plugin manager, XSILoadPlugin is called and if EmbeddedPython::initEmbeddedPython() is executed, PyRun_SimpleString generates <>
If Py_Initialize(); and PyRun_SimpleString(“print ‘TEST'”); are commented there are no problems…XSILoadPlugin is called, the plugin is loaded.
Python.h is included
and
PyRun_SimpleString generates – Unhandled exception at 0x1e893906 in XSI.exe: 0xC0000005: Access violation reading location 0x00000004