[python-win32] I/O error
travel europe
europe_travel at hotmail.com
Mon Mar 22 22:22:40 CET 2010
Hello,
I am getting the following error "ValueError: I/O operation on closed file" when running a module to pull data from the Windows registry.
The code is as follows:
<code>
import csv
from winsys import registry
key = r"HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall"
fields = ["DisplayName", "Comments", "InstallDate"] # add to as required
uninstall = registry.registry (key)
with open ("installed.txt", "wb") as f:
writer = csv.writer (f)
writer.writerow (fields)
for subkey in uninstall:
info = dict (subkey.values ())
writer.writerow ([info.get (field) for field in fields])
<code>
<error message>
The error message is as follows:
Traceback (most recent call last):
File "C:\Python26\tim.py", line 13, in <module>
writer.writerow ([info.get (field) for field in fields])
ValueError: I/O operation on closed file
<error message>
Any ideas on how to rectify this problem? Thanks!
_________________________________________________________________
Hotmail is redefining busy with tools for the New Busy. Get more from your inbox.
http://www.windowslive.com/campaign/thenewbusy?ocid=PID27925::T:WLMTAGL:ON:WL:en-US:WM_HMP:032010_2
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-win32/attachments/20100322/c9505625/attachment.html>
More information about the python-win32
mailing list