You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
def clean_pdf_file(filename):
"""
strip leading and/or trailing junk from a PDF file
"""
with open(filename, 'r+b') as file, mmap.mmap(file.fileno(), 0, access=mmap.ACCESS_WRITE) as mmfile:
start = mmfile.find(b'%PDF-')
if start == -1:
# no PDF marker found
LOGGER.debug('not a PDF file')
return
end = mmfile.rfind(b'%%EOF')
offset = len(b'%%EOF')
if start > 0:
LOGGER.debug('moving and truncating')
mmfile.move(0, start, end + offset - start)
#mmfile.resize(end + offset - start)
mmfile.flush()
elif end > 0 and end + offset != mmfile.size():
LOGGER.debug('truncating only')
> mmfile.resize(end + offset - start)
E SystemError: mmap: resizing not available--no mremap()
../venv/lib/python3.10/site-packages/refextract/references/engine.py:1412: SystemError
The text was updated successfully, but these errors were encountered:
Hu1buerger
changed the title
clean_pdf_file throws SystemError: mmap: resizing not available
clean_pdf_file throws SystemError on MacOS with mmap: resizing not available
May 10, 2023
When running extract
extract_references_from_file(path)
on this fileKotti et al. - 2023 - Machine Learning for Software Engineering A Terti.pdf
on MacOS Ventura 13.3.1 the following exception gets thrown.
The text was updated successfully, but these errors were encountered: