Giter VIP home page Giter VIP logo

zotero-cli's Issues

Unknown item type 'annotation'

Running into an issue downloading the attachments. Seems like annotations aren't supported yet.

zotero-cli --verbose
23:36:16 [DEBUG] Getting collections from cache '/home/user/.zotero/cache/collections.json'...
23:36:16 [DEBUG] Getting items from cache '/home/user/.zotero/cache/items.json'...
23:36:16 [DEBUG] Getting attachments from zotero.org...
^TTraceback (most recent call last):
  File "/home/user/.pyenv/versions/3.10.6/bin/zotero-cli", line 117, in __init__
    with cached_file.open() as f:
  File "/home/user/.pyenv/versions/3.10.6/lib/python3.10/site-packages/pathlib2/__init__.py", line 1548, in open
    return io.open(
  File "/home/user/.pyenv/versions/3.10.6/lib/python3.10/site-packages/pathlib2/__init__.py", line 1383, in _opener
    return self._accessor.open(self, flags, mode)
  File "/home/user/.pyenv/versions/3.10.6/lib/python3.10/site-packages/pathlib2/__init__.py", line 646, in wrapped
    return strfunc(str(pathobj), *args)
FileNotFoundError: [Errno 2] No such file or directory: '/home/user/.zotero/cache/attachments.json'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/user/.pyenv/versions/3.10.6/bin/zotero-cli", line 889, in <module>
    z = ZoteroCLI(args.id, ["user", "group"][args.group or GROUP_FILE.exists()], args.key)
  File "/home/user/.pyenv/versions/3.10.6/bin/zotero-cli", line 145, in __init__
    raise ValueError("Unknown item type '%s'" % c['data']['itemType'])
ValueError: Unknown item type 'annotation'

Feature request: Showcase more sort and export options

I think this tool looks really good! It would be great to have more export options (say to MD, HTML, text) and flexibility in what data you can export. However I do not know if that is outside of the focus of this.

Failure saving results on setup/reset

% ls $HOME/.zotero/cache 
collections.json  items.json

% zotero-cli -v           
18:13:31 [DEBUG] Getting collections from zotero.org...
18:13:31 [DEBUG] Saving collections to cache '/home/user/.zotero/cache/collections.json'...
18:13:31 [DEBUG] Getting items from zotero.org...
18:14:17 [DEBUG] Saving items to cache '/home/user/.zotero/cache/items.json'...
18:14:18 [DEBUG] Getting attachments from zotero.org...
Traceback (most recent call last):
  File "/home/user/.pyenv/versions/3.10.6/bin/zotero-cli", line 114, in __init__
    with cached_file.open() as f:
  File "/home/user/.pyenv/versions/3.10.6/lib/python3.10/site-packages/pathlib2/__init__.py", line 1548, in open
    return io.open(
  File "/home/user/.pyenv/versions/3.10.6/lib/python3.10/site-packages/pathlib2/__init__.py", line 1383, in _opener
    return self._accessor.open(self, flags, mode)
  File "/home/user/.pyenv/versions/3.10.6/lib/python3.10/site-packages/pathlib2/__init__.py", line 646, in wrapped
    return strfunc(str(pathobj), *args)
FileNotFoundError: [Errno 2] No such file or directory: '/home/user/.zotero/cache/attachments.json'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/user/.pyenv/versions/3.10.6/bin/zotero-cli", line 888, in <module>
    z = ZoteroCLI(args.id, ["user", "group"][args.group or GROUP_FILE.exists()], args.key)
  File "/home/user/.pyenv/versions/3.10.6/bin/zotero-cli", line 135, in __init__
    if i['meta']['numChildren'] > 0:
KeyError: 'numChildren'

Creating the file as empty json works

% echo "{}" > $HOME/.zotero/cache/attachments.json 
% echo "{}" > $HOME/.zotero/cache/notes.json 
% echo "{}" > $HOME/.zotero/cache/annotations.json 

zotero-cli -v                                     
18:28:37 [DEBUG] Getting collections from cache '/home/user/.zotero/cache/collections.json'...
18:28:37 [DEBUG] Getting items from cache '/home/user/.zotero/cache/items.json'...
18:28:37 [DEBUG] Getting attachments from cache '/home/user/.zotero/cache/attachments.json'...
18:28:37 [DEBUG] Getting notes from cache '/home/user/.zotero/cache/notes.json'...
18:28:37 [DEBUG] Getting annotations from cache '/home/user/.zotero/cache/annotations.json'...
18:28:37 [DEBUG] Opening marks from cache '/home/user/.zotero/cache/marks.json'...

Of course then the cache files are empty, and zotero-cli reset will delete the files and start from scratch again.

Example code leads to errors

Not a blocker for me. In the README, there is the following example code:

zotero-cli show year title itemType numPages --filter "collections:biblio" --filter "title:detect" --limit ">date:10"

Looks like it has some issues handling the data it has. I get for pages errors if the page is as not an integer.

19:28:30 [WARNING] Bad pages value 'S20'

Dates also fail a lot with the following error:

19:34:24 [WARNING] Bad datetime format: January 1, 2021 for item titled 'XXXX'. Using default date 1900-01-01.

Different time formats that throw errors:

July 1, 2021
2021/11
2021/07/05
2019-07-20T05:00:01

More errors

% zotero-cli show - --query "top-50-most-relevants"
19:28:30 [WARNING] Bad pages value '...'
19:42:12 [WARNING] Bad datetime format: .... for item titled '...'. Using default date 1900-01-01.
... a lot more warnings as the above two ...
Traceback (most recent call last):
  File "/home/user/.pyenv/versions/3.10.6/bin/zotero-cli", line 905, in <module>
    z.show(args.field, args.filter, args.sort, args.desc, args.limit)
  File "/home/user/.pyenv/versions/3.10.6/lib/python3.10/site-packages/tinyscript/preimports/log.py", line 99, in _wrapper
    return f(*args, **kwargs)
  File "/home/user/.pyenv/versions/3.10.6/lib/python3.10/site-packages/tinyscript/helpers/decorators.py", line 112, in wrapper
    return f(*args, **kwargs)
  File "/home/user/.pyenv/versions/3.10.6/bin/zotero-cli", line 705, in show
    headers, data = self._items(fields, filters, sort, desc, limit)
  File "/home/user/.pyenv/versions/3.10.6/bin/zotero-cli", line 484, in _items
    dt = set(ZoteroCLI.date(i['data']['date']).timestamp() for i in items.values()) - {dt_zero}
  File "/home/user/.pyenv/versions/3.10.6/bin/zotero-cli", line 484, in <genexpr>
    dt = set(ZoteroCLI.date(i['data']['date']).timestamp() for i in items.values()) - {dt_zero}
KeyError: 'date'

Import .bibtex to zotero library

Hi, I'm wondering if it is possible to import .bibtex file to zotero from command line?

sth like zotero-cli import xxx.bib

Thank you!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.