papis / papis-zotero

Zotero compatibility layer for papis
GNU General Public License v3.0
75 stars 17 forks source link

from-sql import fails to open database file #14

Closed jghauser closed 1 year ago

jghauser commented 3 years ago

I get the following error both on the last release and on master (command run inside the folder with zotero.sqlite):

❯ papis zotero import --from-sql zotero.sqlite --outfolder ~/Papis_test
Traceback (most recent call last):
  File "/usr/bin/papis", line 33, in <module>
    sys.exit(load_entry_point('papis==0.11.1', 'console_scripts', 'papis')())
  File "/usr/lib/python3.9/site-packages/click/core.py", line 829, in __call__
    return self.main(*args, **kwargs)
  File "/usr/lib/python3.9/site-packages/click/core.py", line 782, in main
    rv = self.invoke(ctx)
  File "/usr/lib/python3.9/site-packages/click/core.py", line 1259, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/usr/lib/python3.9/site-packages/click/core.py", line 1259, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/usr/lib/python3.9/site-packages/click/core.py", line 1066, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/usr/lib/python3.9/site-packages/click/core.py", line 610, in invoke
    return callback(*args, **kwargs)
  File "/usr/lib/python3.9/site-packages/papis_zotero/__init__.py", line 80, in do_importer
    papis_zotero.sql.add_from_sql(
  File "/usr/lib/python3.9/site-packages/papis_zotero/sql.py", line 237, in add_from_sql
    connection = sqlite3.connect(os.path.join(inputPath, "zotero.sqlite"))
sqlite3.OperationalError: unable to open database file
reyman commented 3 years ago

same here ...

storopoli commented 2 years ago

Hey folks, you need to point the papis zotero import --from-sql to the FOLDER not the FILE:

$ papis zotero import -h
Usage: papis zotero import [OPTIONS]

  Import zotero libraries into papis libraries

Options:
  -h, --help              Show this message and exit.
  -f, --from-bibtex PATH  Import zotero library from a bibtex dump, the files
                          fields in the bibtex files should point to valid
                          paths
  -s, --from-sql PATH     Path to the FOLDER where the "zotero.sqlite" file
                          resides
  -o, --outfolder TEXT    Folder to save the imported library  [required]
  --link TEXT             Wether to link the pdf files or copy them
michaelmior commented 1 year ago

This worked, but I think the README needs updating. The command given is below:

papis zotero import --from-sql YOUR-SQL-FILE

To me, this suggests that I should use the path of the file, not the folder.

alejandrogallo commented 1 year ago

You're all right, I updated the README and added the --from-sql-folder flag. I gladly accept volunteers btw to maintain papis-zotero ;)