Re: [python-win32] issues with win32com constants and static/dynamicdispatch

2007-07-04 Thread Jason Ferrara
c = win32com.client.Dispatch(c.QueryInterface(pythoncom.IID_IDispatch)) works. Thanks! FYI, c=win32com.client.Dispatch(c) does not. >>> c=win32com.client.Dispatch(c) Traceback (most recent call last): File "", line 1, in File "C:\Python25\Lib\site-packages\win32com\client\__init__.py", l

[python-win32] Python Magazine - pywin32

2007-07-04 Thread Michael Foord
Hello all, There is a new Python magazine just launching: http://www.pythonmagazine.com They are looking for articles that will appeal to Windows users, so if anyone fancies getting paid to write an article on pywin32 I'm sure they will be interested. Michael Foord http://www.voidspace.or

Re: [python-win32] Threading Issue

2007-07-04 Thread Bob Gailer
Following is untested but based on other work I've done: import threading class Foo: def __init__(self): self.list = [] def run(self): # manipulate the list from within the thread foo = Foo() threading.Thread(target = foo.run) ... foo.list # access the list as modified by t

Re: [python-win32] win32com array handling bug?

2007-07-04 Thread Mark Hammond
> On Jul 4, 2007, at 7:12 PM, Mark Hammond wrote: > > > >> > >> At this point f should be a 2048 by 1536 array of bytes, but > >> instead... > >> > > len(f) > >> 2048 > > type(f) > >> > > > > Arrays of type VT_UI1 are returned as buffers. You should > find the > > length > > of f is 1

Re: [python-win32] win32com array handling bug?

2007-07-04 Thread Jason Ferrara
On Jul 4, 2007, at 7:12 PM, Mark Hammond wrote: > >> >> At this point f should be a 2048 by 1536 array of bytes, but >> instead... >> > len(f) >> 2048 > type(f) >> > > Arrays of type VT_UI1 are returned as buffers. You should find the > length > of f is 1536, and you can treat it as

Re: [python-win32] win32com array handling bug?

2007-07-04 Thread Mark Hammond
> I'm making a COM call that should return a two dimensional > array, but > instead I get back a buffer that appears to only contain a > single row > from the array. > > Python 2.5.1 (r251:54863, Apr 18 2007, 08:51:08) [MSC v.1310 32 bit > (Intel)] on > win32 > Type "help", "copyright", "credits" o

Re: [python-win32] Strange/impossible Python COM interface behavior

2007-07-04 Thread Mark Hammond
> from win32com.client import DispatchBaseClass > > I'm unable to find DispatchBaseClass and so can not chase the > issue further Its in win32com.client.__init__.py > (never mind that I'm a bit over my head in the Win32Com code). > Interestingly, __repr__ is NOT in the GenPY output code, so I > a

Re: [python-win32] issues with win32com constants and static/dynamicdispatch

2007-07-04 Thread Mark Hammond
That is strange - the problem is that the resulting COM object is returning an IUnknown rather than an IDispatch. A work around should be to say: c = cams[0] c = win32com.client.Dispatch(c) or possibly: c = win32com.client.Dispatch(c.QueryInterface(pythoncom.IID_IDispatch)) I think we could al

[python-win32] win32com array handling bug?

2007-07-04 Thread Jason Ferrara
I'm making a COM call that should return a two dimensional array, but instead I get back a buffer that appears to only contain a single row from the array. Python 2.5.1 (r251:54863, Apr 18 2007, 08:51:08) [MSC v.1310 32 bit (Intel)] on win32 Type "help", "copyright", "credits" or "license" f

Re: [python-win32] Strange/impossible Python COM interface behavior

2007-07-04 Thread Richard Bell
A bit more testing revealed that there are two issues, one a bug in my code and the other a potential issue with the python COM code. First, I'd written a routine to flash an IE DOM node and moved it into a class. Unfortunately, I coded it like this in the class: def DomFlash(node, flashes=5

Re: [python-win32] Strange/impossible Python COM interface behavior

2007-07-04 Thread Richard Bell
Thanks Emlyn, that's got me a bit further. I tried your suggestions and also tried to see if the object was the one expected. Here's the output: node0 = nodes[0] print 'DomGetANodeFilterValue type', type(node0) # DomGetANodeFilterValue type print 'DomGetANodeFil

Re: [python-win32] Strange/impossible Python COM interface behavior

2007-07-04 Thread Emlyn Jones
On 7/4/07, Richard Bell <[EMAIL PROTECTED]> wrote: > > In my continued work on a COM automation interface for IE I've encountered a > strange/impossible Python behavior. Here's what appears to be the offending > code: > > - code - > nodes = self.DomGetNListFilterValue(node, tags, p

[python-win32] Strange/impossible Python COM interface behavior

2007-07-04 Thread Richard Bell
In my continued work on a COM automation interface for IE I've encountered a strange/impossible Python behavior. Here's what appears to be the offending code: - code - nodes = self.DomGetNListFilterValue(node, tags, properties, value, i

[python-win32] issues with win32com constants and static/dynamic dispatch

2007-07-04 Thread Jason Ferrara
I'm trying to use a COM library from python. If I use dynamic dispatch, the com objects all behave correctly, but the constants defined in the COM library don't show up. If I use static dispatch, the constants show up, but COM objects returned by calls into the COM library seem broken. As

Re: [python-win32] issues with win32com constants and static/dynamic dispatch

2007-07-04 Thread Jason Ferrara
On Jul 4, 2007, at 11:20 AM, Simon Dahlbacka wrote: my best guess is that you should be using .ProductName (capital p) as static dispatch is case sensitive.. /S Thats not it. productName is the correct case. And also.. >>> print c >>> dir(c) ['QueryInterface', '__class__', '__cmp__',

Re: [python-win32] issues with win32com constants and static/dynamic dispatch

2007-07-04 Thread Simon Dahlbacka
my best guess is that you should be using .ProductName (capital p) as static dispatch is case sensitive.. /S On 7/4/07, Jason Ferrara <[EMAIL PROTECTED]> wrote: I'm trying to use a COM library from python. If I use dynamic dispatch, the com objects all behave correctly, but the constants defi