Both your code snippets above work should work OK. If it seems like a file isn't being written, maybe you should specify its full path so you are sure about where to check for it.
On the file-or-open question, the Python docs state, "The intent is for open() to continue to be preferred for use as a factory function which returns a new file object." I happen to know that because it was clarified for me recently by a few posters in this informative thread: http://groups.google.com/group/comp.lang.python/browse_frm/thread/fbc7fbacf0866763 (which didn't start out as a file-or-open discussion, but there you go). Hope this helps, Jason -- http://mail.python.org/mailman/listinfo/python-list