[python-win32] Friendlier pywintypes.com_error mess ages

2008-08-08 Thread Brad Johnson
I am using pywin32 scripting as a client to my C++ COM application. Many of my functions in C++ are returning errors such as E_FAIL, E_POINTER, E_INVALIDARG, etc... However, the error message in Python is often cryptic such as a simple "Exception occurred" with the error code. I suppose I could h

[python-win32] WIN32COM: Cannot get event interface given a wrapped dispatch pointer

2008-10-23 Thread Brad Johnson
This problem seems to be related to a post from a while back http://markmail.org/message/moyolyvs5i26vbwr It all comes down to the getevents(clsid) function defined in win32com/client/__init__.py This function expects an incoming clsid, but it never is one. The incoming clsid is _actually_ the II

Re: [python-win32] WIN32COM: Cannot get event interface g iven a wrapped dispatch pointer

2008-10-23 Thread Brad Johnson
Mark Hammond skippinet.com.au> writes: > > Eeek. Have you actually imported the other library, or simply copied the > interface definition. I'd be surprised to find the same interface defined > in 2 typelibs (but not surprised to see cross-typelib references). > I think I was a bit vague in m

Re: [python-win32] WIN32COM: Cannot get event interface g iven a wrapped dispatch pointer

2008-11-10 Thread Brad Johnson
Brad Johnson ballardtech.com> writes: Just as a follow-up, this didn't even end up being a complete solution. With my particular combination of type libraries in my application, I can't rely on the gencache to hold the correct mapping in the mapCLSIDToClass dict for reasons state

Re: [python-win32] WIN32COM: Cannot get event interface g iven a wrapped dispatch pointer

2008-11-11 Thread Brad Johnson
Mark Hammond skippinet.com.au> writes: > > While you have obviously struck a bug, I need to understand it more before I > can comment further. I'll try and reproduce it using the C++ test object > and IDL file - if you could help do that it would be greatly appreciated and > help a timely solut

[python-win32] The GIL and COM

2009-01-21 Thread Brad Johnson
I have embedded the Python interpreter into a COM application. In this application, I create worker threads that execute Python code. I marshal some COM objects that live in the UI thread of the application over to the worker thread and wrap them with EnsureDispatch() for use in the new thread. M

Re: [python-win32] The GIL and COM

2009-01-21 Thread Brad Johnson
> > However, while it is waiting for the > > GIL in the UI thread (when the worker thread has it), it is locked into a > > WaitForSingleObject call (some layers below PyGILState_Ensure). > > Obviously the GIL can only be held by one thread at a time. The > question then is why your worker thread

Re: [python-win32] The GIL and COM

2009-01-22 Thread Brad Johnson
> So one your thread has acquired the GIL, one of 3 things happens: > > * It returns quickly and the GIL is released. > * It executes many many instructions: every 'n' instructions Python will > temporarily release the GIL for you. > * It calls some other blocking function. This other blocking f

[python-win32] Utilizing a raw IDispatch Pointer from Python

2007-07-31 Thread Brad Johnson
I have a C++ application that creates a collection of COM objects. I am embedding a Python interpreter that will have access to Automation objects written in C++. I would like to give the Python interpreter access to the IDispatch interface on these objects. Stated another way, how can I have Pyt

Re: [python-win32] Utilizing a raw IDispatch Pointer from Python

2007-08-01 Thread Brad Johnson
> > PyCom_PyObjectFromIUnknown can be used to wrap an IDispatch pointer in a > PyIDispatch object. > > Roger > Thanks a ton, Roger! I spend a good amount of time trying to find an answer to my question, but now that I have that function name there is a bunch of info through Google to ge

[python-win32] Follow-up question

2007-08-27 Thread Brad Johnson
Brad Johnson ballardtech.com> writes: I have successfully used the PyCom_PyObjectFromIUnknown function to get a PyIDispatch object from a raw IDispatch pointer. My next goal is to get an early bound class instance from that pointer (using a class generated from makepy). I can take

[python-win32] C++ thread cannot acquire GIL

2007-11-06 Thread Brad Johnson
I am embedding a Python interpreter in a C++ app for Windows. The main thread in my application calls PyEval_InitThreads(); At some point, the main thread creates a new thread to do some concurrent work using the Python interpreter. The trouble is that in my worker thread I am never able to comp

Re: [python-win32] C++ thread cannot acquire GIL

2007-11-08 Thread Brad Johnson
Brad Johnson ballardtech.com> writes: > > I am embedding a Python interpreter in a C++ app for Windows. > > The main thread in my application calls PyEval_InitThreads(); > > At some point, the main thread creates a new thread to do some concurrent work > using the Pyth

[python-win32] Max parameters in method of IConnectionPoint interface?

2008-03-26 Thread Brad Johnson
I have implemented an object that supports connection points in COM. In ATL, there is a #define that limits the number of parameters supported for a connection point client: #define _ATL_MAX_VARTYPES 8 I have one function that has 11 parameters, so for my C++ client (using ATL) I had to redefine

Re: [python-win32] Max parameters in method of IConnectio nPoint interface?

2008-03-27 Thread Brad Johnson
Mark Hammond skippinet.com.au> writes: > There is no arbitrary limit that I recall. Can you show us a snippet of > failing code and the traceback? > > Thanks, > > Mark > Hi Mark, I've gotten right down to the problem. Has nothing to do with the number of parameters. One of the parameters is

Re: [python-win32] Max parameters in method of IConnectio nPoint interface?

2008-03-27 Thread Brad Johnson
Brad Johnson ballardtech.com> writes: > So I guess my question becomes how can I change the parameter type so everyone > is happy? > Never mind. I managed to make it a reference to a SAFEARRAY of USHORTS without a hiccup from either client. I guess I need to brush up a little b

Re: [python-win32] Max parameters in method of IConnect ionPoint interface?

2008-03-27 Thread Brad Johnson
Mark Hammond skippinet.com.au> writes: > Pass it as a variant holding the actual type instead of adding a kind of > "indirection". > > Cheers, > > Mark > Thanks. That's exactly what I ended up doing. I guess I was just a little too green to do it right the first time. I didn't know how to pas

Re: [python-win32] Max parameters in method of IConne ctionPoint interface?

2008-03-27 Thread Brad Johnson
Mark Hammond skippinet.com.au> writes: > but the code fails to gracefully handle the non-byref variant case, as you > found. Oh well, some other day (or if someone is keen, a bug couldn't > hurt...) > > Cheers, > > Mark > I added a bug to the SourceForge bug tracker :-). ___

[python-win32] Creating an MSI of pywin32

2008-04-22 Thread Brad Johnson
Hello everyone, I am attempting to create an MSI of pywin32 so I can have it silently install with another application. I am running into this error and traceback when executing "python setup.py bdist_msi" running install_egg_info Writing build\bdist.win32\msi\Lib\site-packages\pywin32-210-py2.5

Re: [python-win32] holiday

2008-04-22 Thread Brad Johnson
Mark Hammond skippinet.com.au> writes: > > Hi all, > FYI, I'm off on a 2 week vacation to China (wh!) > Hope it is an enjoyable break for you, you deserve it :-) ___ python-win32 mailing list python-win32@python.org http://mail.python.org/mai

Re: [python-win32] Creating an MSI of pywin32

2008-04-22 Thread Brad Johnson
Brad Johnson ballardtech.com> writes: Note, I can fix this by hard coding a valid version in \distutils\command\bdist_msi.py by changing sversion = "%d.%d.%d" % StrictVersion(version).version to sversion = "210" (where 210 is the build number) But, obviously this just