Please help here: python <==> COM

mep mep_ at 163.com
Sat Dec 4 21:23:35 EST 2004


Hi,all
    I'm scripting flashget (A download management tool,
http://www.amazesoft.com/) using
python win32 extension, opening a downloading dialog.
The following pythong code NOT work:
====CODE BEGIN====
 #!/usr/bin/env python
 # -*- coding: cp936 -*-

 import win32com.client

 flashget = win32com.client.Dispatch('JetCar.Netscape')
 params = ('http://test.com/1',
           'http://test.com/2',
           'http://test.com/3',
           'http://test.com/4',
           'http://test.com/5')

 flashget.AddUrlList(params)
====CODE END====

It complaints the following:
  File "<COMObject JetCar.Netscape>", line 2, in AddUrlList
pywintypes.com_error: (-2147352567, 'Exception occurred.', (0, None, None,
None,  0, -2146828283), None)

But the following VBS code does the tricky:
====CODE BEGIN====
 Dim params(4)
 set flashget=CreateObject("JetCar.Netscape")

 params(0) = "http://test.com/1"
 params(1) = "http://test.com/2"
 params(2) = "http://test.com/3"
 params(3) = "http://test.com/4"
 params(4) = "http://test.com/5"

 flashget.AddUrlList params
====CODE END====

Any hints?

-- 
Best Regards,
Wang Kebo

http://www.huihoo.org/~mep





More information about the Python-list mailing list