It would be better, though, to test explicitly for None and not write the result to a file when it is None. sBuffer = m_XMLDoc.transformNode(xslDoc) if sBudder is None: print "Error: transformNode returned None" else: f = open( outFile, 'w') f.write(sBuffer) f.close() Jeremy