COM Server crashing when returning large arrays

Tim Golden tim.golden at
Tue May 23 09:42:20 CEST 2006

[Alastair Alexander]

| Hi ... I'm using pythoncom to create a python COM server 
| application that needs to be able to return large arrays 
| to COM client apps. For example, I need to be able to 
| return an array to Excel that is 500 by 10, with each 
| element of the array holding a 32 byte string.
| If I run the code for smaller arrays, say 10 by 10, it works 
| fine. If I allow the server to try to return the entire 500 
| by 10 array, pythonw.exe causes a memory access violation and 
| dies and I get an "automation exception" error message in the 
| client app.
| I assume I'm violating some upper limit for data transfer 
| from pythoncom into COM. Anyone know if such limitations 
| exist? Is there a way around them? Can anyone point me in 
| the right direction?

OK, no straight answer from me, merely a few hints:

This is going to be *very* specific to the pywin32 stuff
and Python & Win32 in general. In case you haven't come
across it, there is a mailing list aimed at these things:

While I'm sure a lot of its readers (myself included)
also follow, it's possible that some usefully
knowledgeable ones don't. In particular, Mark Hammond
who is the author of the pythoncom stuff: I don't
remember seeing him post on while he's definitely
there on python-win32.

(Altho' you've said you're new to newsgroups etc., it's
not clear how new you are to Python & Win32; I might just
be teaching my Grandmother...)

Worth running the code from a straight console, ie not
PythonWin / pythonw.exe just in case something there
is getting in the way. You didn't post any sample code,
but if you could narrow the example down to a few lines
with the COM server framework and post it, I at least
am quite happy to try to test it to see if perhaps the
issue is machine / configuration specific.

Other than that, I'm afraid you're down to people with
far more knowledge than me of the pythoncom internals.
(Which is, let's face it, most people).


This e-mail has been scanned for all viruses by Star. The
service is powered by MessageLabs. For more information on a proactive
anti-virus service working around the clock, around the globe, visit:

More information about the Python-list mailing list