Dealing with OLE error

John Moore john at spamfree.co.uk
Tue May 28 11:10:43 EDT 2002


I'm using the WinFax SDK to script WinFax under Windows 2000. I was using VBScript under Windows Script Host but was unable 
to do everything I wanted with that, so I switched to Python. I now have a total of about 6 hours experience with Python, so 
please be gentle with me...

Anyway, the problem (as with VBScript) comes with the following line, which converts a fax file from WinFax format to 
something else (in this case TIFF):

  result=objFXConverter.ConvertFromFX(fullInputFileName,fullOutputFileName)

Now, result is an SCODE. With VBS/WSH I wasn't able to do anything with this at all, not even display it, which was my 
initial  motivation for trying Python instead. With Python at least I can compare it with 0 to find if it's worked OK. I was 
hoping, though, to be able to get a little more useful information if it failed than what I have. At present, I test the 
result if it's non-zero with:

  pythoncom.GetScodeString(result)

This, alas, does not give me a helpful description of what went wrong, but simply the following not-so-useful string:

  'OLE error 0xe0040122'

How can I get some more useful information about this? It is worth noting that enclosing the problem line within a 
try...except block doesn't do anything - clearly a COM exception is not being thrown, merely a non-zero result returned.

Any help much appreciated...

John





More information about the Python-list mailing list