Hi everyone,
I'm just starting to look into PyMarc for my work project preparing MARC records that have originated from the Archivists' Toolkit to import into our ILS (Aleph). and I'm also new to Python in general. I'm coming across some error messages that I'm not able to decipher but I'm assuming it's likely some amateur mistake, so just thought I'd write to see if someone here could help get me started.
right now, I'm just trying to read a .mrc file of raw MARC records, and my very basic script works to a point (i.e., I get a number of records to print), but I get these errors at the end of the screen output:
------------------------------------------------------------------------------------------
Traceback (most recent call last):
File "./BHS2.py", line 7, in <module>
for record in reader:
File "/Users/heidifrank/Documents/NYU/BHS-AT2Aleph/pymarc/reader.py", line 87, in next
utf8_handling=self.utf8_handling)
File "/Users/heidifrank/Documents/NYU/BHS-AT2Aleph/pymarc/record.py", line 54, in __init__
utf8_handling=utf8_handling)
File "/Users/heidifrank/Documents/NYU/BHS-AT2Aleph/pymarc/record.py", line 158, in decode_marc
raise RecordDirectoryInvalid
pymarc.exceptions.RecordDirectoryInvalid: Invalid directory
------------------------------------------------------------------------------------------
here's my python script:
#!/usr/bin/python
from pymarc import MARCReader
reader = MARCReader(open('00-All_MRC.mrc'))
for record in reader:
if not record['100'] and not record['110']:
print record
and I've attached the .mrc file that I'm reading. when I downloaded the pymarc module, I opened the tar.gz file so that I had a folder called "pymarc-2.8.4" and inside that folder was the folder "pymarc" along with other files/folders (e.g., ez_setup.py, MANIFEST.in, PKG-INFO, etc). I copied just the folder "pymarc" into the directory with my python script (only cause I wasn't sure how to point to the folder within the parent folder), so i'm wondering if that's the problem... are the other files in the parent folder needed for the module to work?
Can anyone tell offhand if these errors have to do with the location of my pymarc module, or if it has something to do with the .mrc file I'm reading, or something else...?
any ideas much appreciated!
heidi