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
_______________________________________________
python-win32 mailing list
python-win32@python.org
http://mail.python.org/mailman/listinfo/python-win32

Reply via email to