BSTR

Aleksandar Cikota alexci at gmx.net
Thu Apr 13 14:43:40 EDT 2006


 Hi all,



I'm beginner in Python and need help. I'm writing software for a robotic
telescope. For CCD camera control we use MaxIm DL (Diffraction Limited). I
have a problem with CCDCamera.SaveImage.



Error message:

>    File "S:MaxImmaxim.py", line 19, in ?

>      CCDCamera.SaveImage('C:/1.fit')

>    File "C:ProgrammePython24Libsite-

> packageswin32comclientdynamic.py", line 491, in __getattr__

>      raise pythoncom.com_error, details

> com_error: (-2147352567, 'Ausnahmefehler aufgetreten.',

> (65535, 'MaxIm DL 4', 'Invalid Input', None, 0, 0), None)





Here is the answer that we recieved from Diffraction Limited:

---------

For CCDCamera.SaveImage, 'Invalid Input' is reported only if the argument is

not of an acceptable type.  As you are probably aware from looking at the

type library, the filename argument is declared as a variant.  What the type

library doesn't tell you is that the variant must be either a BSTR (unicode

string with header) or a reference to a BSTR.  Specifically, the 'vt' member

of the VARIANT must be either VT_BSTR or VT_BSTR|VT_BYREF.



Does python provide any way of influencing how arguments for COM methods are

created?  If so, you may be able to get this to work.  It may be as simple

as assigning the string to a variable name instead of passing it as a

literal, or perhaps there's something equivalent to a C++ cast operator or a

VB 'type' function (CInt, CStr, etc.).



This problem is likely to affect any MaxIm DL automation method that takes a

string as an argument.

---------





The question is, how to convert a String in a BSTR (unicodestring with
header)?





For your prompt reply, I say thank you in advance.

 

Best regards,

Aleksandar Cikota

 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20060413/392b5e6f/attachment.html>


More information about the Python-list mailing list