> I'm hoping someone can give me some advice, or point me in a > helpful direction. > > I've embedded python 2.4 within an application that needs to > connect with > MS Excel. > I've written the python code to communicate with Excel and > tested it from > the python > command line interpreter. It works great! However, when I > attempt to > import win32com > from within the embedded interpreter I get the following: > > "Fatal Python error: Can not setup interpreter state, as > current state is > invalid"
You need to look into the PyGILState_* functions. These functions allow you to acquire the thread-lock before calling into Python. Your code will look something like: PyGILState_STATE old_state = PyGILState_Ensure() // you can now safely call Python functions from this thread. // When all your Python work is complete... PyGILState_Release() // The lock for this thread has now been released. This thread can // no longer safely call Python functions until the lock is re-acquired. Mark _______________________________________________ Python-win32 mailing list Python-win32@python.org http://mail.python.org/mailman/listinfo/python-win32