COM bites - help please

Mark Hammond MHammond at skippinet.com.au
Mon Jul 26 19:41:40 EDT 1999


Karl Putland wrote in message ...
> >>> c1.fields        # This is a util.Collection(list of GMField
instances)
> Traceback (innermost last):
>   File "<pyshell#56>", line 1, in ?
>     c1.fields

Have you tried using the debugging flags?  This can help alot.  If you
register your object with "--debug", you can use either Pythonwin or
win32traceutil.py to see exceptions from the server side of Python COM.

This is likely to show a traceback saying something like "object does not
support the policy" - ie, as Bill said, you need a list of wrapped objects,
not Python classes.

[However, win32com.server.util really should grow helpers for this - a
reasonable and common requirement - feel free to propose a change!]

> 3. PyUnicode objects bit me in the ass when strings are passed into
methods and manipulated.
> class Foo:

After reading Bills reply and your followup, Im unsure what your remaining
problem is with this.  You have discovered that "str()" is the simplest way
to work with them, and we know that Python 1.5 and Unicode integration
suck - but is there some other Unicode problem you are having beyond this?

> >>>foo = win32com.client.Dispatch("Python.Foo")
> >>>foo.bar("Hello World")

> Some traceback about TypeError PyUnicode.

Again, use the "--debug" option, and you will also see a traceback on the
server side.  This will point you at the problem.

Mark.






More information about the Python-list mailing list