Your statement:
res = conn.search(query)
return a ResultSet
, accordingly to http://www.panix.com/~asl2/software/PyZ3950/zoom.html
Each record r
in the resultSet
have the data in r.data
So, you have to feed the MARCReader with each r.data
or with them all concatenated.
This will work:
from PyZ3950 import zoom, zmarc
from pymarc import MARCReader
conn = zoom.Connection('z3950.loc.gov', 7090)
conn.databaseName = 'VOYAGER'
conn.preferredRecordSyntax = 'USMARC'
query = zoom.Query('CCL', 'ti="1066 and all that"')
res = conn.search(query)
marc = ''
for r in res:
marc = marc + r.data
reader = MARCReader(marc)
for record in reader:
print record.title()
conn.close()