473,399 Members | 2,478 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,399 software developers and data experts.

BSTR

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.
---------
Here is the code (Python):

import win32com.client, time
CCDCamera = win32com.client.Dispatch('MaxIm.CCDCamera')
CCDCamera.LinkEnabled = True
if CCDCamera.LinkEnabled == False:
print 'Failed to start camera.'
exp = int(raw_input('Exposition[sec]: '))
CCDCamera.Expose(exp, 1, 0)
while CCDCamera.ImageReady == False:
time.sleep
print 'Done'
time.sleep(3)
CCDCamera.SaveImage('C:/1.fit')

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
Apr 13 '06 #1
0 1659

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Chris | last post by:
I am not sure if this is the right newsgroup. But does anyone know what is the difference between a BSTR and a LPOLESTR? The only thing I could find out is that the advantage of taking BSTR...
2
by: banski | last post by:
Hi, Im trying to find out how to convert a SYSTEMTIME to BSTR. Cant find out how to do that. Hopefully some of you could help me out. Best regards Thomas
7
by: Gilad Walden | last post by:
I use C# in .NET framework. I have an ActiveX implemented in C++ that has a COM interface method that gets as it’s out parameter a BSTR* . The interop translates this BSTR* into C# string. From...
8
by: Michael Tissington | last post by:
I have a C++ function in a DLL of the form BSTR WINAPI DoSomeWork(LPCSTR szConnection, LPCSTR szGUID) I use SysAllocStringByteLen to return a BSTR. For the most part this works accept when...
0
by: Edwin Knoppert | last post by:
I'm currently using a wrapper which converts an ANSI BSTR from a dll. (Yes, singlebyte but BSTR ! ) This works fine and i'm aware BSTR's returned must be destroyed by the caller, which i do. ...
5
by: bluter | last post by:
We have server components which were created by a third party and compiled in VC++5 (sp3). They run fine on NT4 and 2000, however during testing of our migration to Server 2003, these components...
37
by: Egbert Nierop \(MVP for IIS\) | last post by:
In win32 mode, a BSTR was UINT length prefixed and terminated exactly by a zero char. So if you allocated "Hello World" that would allocate 28 bytes. In x64 and (IA64 as well) it would become...
2
by: Lucy Ludmiller | last post by:
How can I write a function like this: BSTR Greeting(BSTR name) { //return "Good Morning : " + name ; } In short I'm looking for a quick tutorial on using BSTR - Google is not bringing up...
0
by: Jason Smiley | last post by:
So I have a function that is called from a COM object that has a BSTR as an out paramater. A code snippet looks like this: MyComLib.MyComInterface tester = new MyComLib.MyComInterface(); // ...
2
by: mzdude | last post by:
I need to interface with a windows DLL that has the following signature extern "C" void Foo( BSTR in, BSTR *out ) Code so far Traceback (most recent call last): File "<pyshell#14>", line...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.