[python-win32] Urgent reg Type conversion in Python

Sachin S.Suresh sureshsubbiah at india.com
Tue Oct 28 06:48:51 EST 2003


hi ppl,
fine and how r u?
i've got a  problem with the c++  com object usage in python.

i've imported and could able to create an pythin object of a com dll
file using win32com.client library.


<< dll file name is RouterClient.dll and the class name is
RouterClass. RouterClass has a member function such as 
SendMsgToTheServer(int,BSTR)-c++ convention)>>

the code i've used to create is,

-----------------------------------
import win32com.client

obj = win32com.client.Dispatch("RouterClient.RouterClass")

msg = '0100000000101000076xxxxx'

obj.SendMsgToTheServer(432,msg)
# 432 is the channel used to send the message

------------------------------------

Now the problem comes,
if i run this file say sender.py, i've one error message as :

  File
"win32com\gen_py\D9330E72-3056-4517-AD81-0A15DBDA3899x0x1x0.py",
line 34, in SendMsgToTheServer

TypeError: The VARIANT type is unknown (0000001e)

Some observation i found :

* if i create that object in PythonWin editor and while trying to
call that

SendMsgToTheServer(), once i put this open brace, i could c the
parameter data types as,
obj.SendToTheServer(KeyRange = <PyOleEmpty object at
0x0121cCB38,Message = <PyOleEmpty object at 0x0121cCB38)


* The same funtion called from c++ as using the following type
conversion as,

SendToTheServer(452,BSTR(msg)) ... here it works properly

      My problem here is, how can i typecast that message according
to the above desriptions in our python script and send to the server.
   One more thing , My Project Manager asked me no to include any
C/C++ code here with the source code and only python code has to be
exist.
Can u ppl help me out in this Type error??

Eagerly expecting ur reply ..... plz a bit urgent......


bye...take care

Keeeeeeeeeeep (s)mailing
Sachin S.Suresh

"A diamond is just another piece of coal that did well under pressure"



-- 
India.com free e-mail - www.india.com. 
Check out our value-added Premium features, such as an extra 20MB for mail storage, POP3, e-mail forwarding, and ads-free mailboxes!

Powered by Outblaze



More information about the Python-win32 mailing list