Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Skipping out_path.mkdir step when processing paths in directories and per_page_targets isn't used #73

Open
brprkr opened this issue Apr 4, 2024 · 0 comments

Comments

@brprkr
Copy link

brprkr commented Apr 4, 2024

Command (MacOS):
python3 -m remarks "/Users/../Library/Application Support/remarkable/desktop" ./exper-output/ --file_path zotero

Exception:

Traceback (most recent call last):
 File "<frozen runpy>", line 198, in _run_module_as_main
 File "<frozen runpy>", line 88, in _run_code
 File "/Users/../Documents/temp/remarks/remarks/__main__.py", line 151, in <module>
   main()
 File "/Users/../Documents/temp/remarks/remarks/__main__.py", line 147, in main
   run_remarks(input_dir, output_dir, **args_dict)
 File "/Users/../Documents/temp/remarks/remarks/remarks.py", line 92, in run_remarks
   process_document(metadata_path, out_path, doc_type, **kwargs)
 File "/Users/../Documents/temp/remarks/remarks/remarks.py", line 432, in process_document
   pdf_src.save(f"{out_doc_path_str} _remarks.pdf")
 File "/Users/../Documents/temp/remarks/.venv/lib/python3.12/site-packages/fitz/__init__.py", line 5392, in save
   mupdf.pdf_save_document(pdf, filename, opts)
 File "/Users/../Documents/temp/remarks/.venv/lib/python3.12/site-packages/fitz/mupdf.py", line 50393, in pdf_save_document
   return _mupdf.pdf_save_document(doc, filename, opts)
fitz.mupdf.FzErrorSystem: code=2: cannot open file 'exper-output-1/zotero/my_file.pdf _remarks.pdf': No such file or directory

Debug:

out_path.parent: exper-output/zotero
per_page_targets: []
has_ann: True
has_smart_hl: True

per_page_targets being empty list means out_path.mkdir isn't being executed. Addingout_path.mkdir again before where files are saved avoids the exception. (If per_page_targets argument is required, I think this should be reported to the user instead of raising a file-related exception.)

@brprkr brprkr changed the title Skipping out_path.mkdir step when processing paths in directories Skipping out_path.mkdir step when processing paths in directories and per_page_targets isn't used Apr 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant