[python-win32] BSTR

Tim Roberts timr at probo.com
Fri Apr 14 19:41:23 CEST 2006


On Thu, 13 Apr 2006 23:21:26 +0200, "Aleksandar Cikota" <alexci at gmx.net>
wrote:

>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.
>
>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')
>
>
>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)
>>    
>>

Putting on my "wild guess" hat, have you tried backslashes in the file
name instead of forward?

    CCDCamera.SaveImage('C:\\1.fit')
or
    CCDCamera.SaveImage(r'C:\1.fit')

It's possible that their file name validation is a bit too strict.

-- 
Tim Roberts, timr at probo.com
Providenza & Boekelheide, Inc.



More information about the Python-win32 mailing list