Skip to content
This repository has been archived by the owner on Feb 4, 2020. It is now read-only.

Exception at the end of iterating through a marc file. #97

Open
cshintov opened this issue Aug 25, 2016 · 3 comments
Open

Exception at the end of iterating through a marc file. #97

cshintov opened this issue Aug 25, 2016 · 3 comments

Comments

@cshintov
Copy link

When I am Iterating through a marc file containing multiple MARC records, After the last record the following exception is raised.
Traceback (most recent call last):
File "compare_marcs.py", line 320, in
pprint(compare_marc_files(exp, obs))
File "compare_marcs.py", line 299, in compare_marc_files
for exp_marc, obs_marc in izip(expected, observed):
File "/home/shinto/shinto/virtualenvs/marc/local/lib/python2.7/site-packages/six.py", line 558, in next
return type(self).next(self)
File "/home/shinto/shinto/virtualenvs/marc/local/lib/python2.7/site-packages/pymarc/reader.py", line 97, in next
utf8_handling=self.utf8_handling)
File "/home/shinto/shinto/virtualenvs/marc/local/lib/python2.7/site-packages/pymarc/record.py", line 74, in init
utf8_handling=utf8_handling)
File "/home/shinto/shinto/virtualenvs/marc/local/lib/python2.7/site-packages/pymarc/record.py", line 245, in decode_marc
raise BaseAddressInvalid
pymarc.exceptions.BaseAddressInvalid: Base address exceeds size of record

@Wooble
Copy link
Collaborator

Wooble commented Aug 25, 2016

It sounds like your file might be cut off before the end of the last record, or at least pymarc thinks so. How are you opening the file and creating the reader?

@cshintov
Copy link
Author

Hi I am opening the files using 'with' .
exp and obs are the two marc files.

with open(exp) as exp_marcs, open(obs) as obs_marcs:
for exp_marc, obs_marc in izip(expected, observed):
do stuff

Thanks,
Shinto.

On Thu, Aug 25, 2016 at 9:24 PM, Geoffrey Spear [email protected]
wrote:

It sounds like your file might be cut off before the end of the last
record, or at least pymarc thinks so. How are you opening the file and
creating the reader?


You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
#97 (comment), or mute
the thread
https://github.com/notifications/unsubscribe-auth/AK1uDEL-iYiPnPUjTUnKpOACMl7O4Nv0ks5qjbrEgaJpZM4JtKxM
.

@edsu
Copy link
Owner

edsu commented Oct 17, 2017

That's an interesting way to do it. And by interesting I mean I have no idea what it does :-) Can you explain what's going on there?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants