Closed astholkohtz closed 7 years ago
Same here. This is with Zotero 5.0
$ zotcli edit-note CQSG3NYB
Traceback (most recent call last): File "/usr/bin/zotcli", line 11, in load_entry_point('zotero-cli==0.3.0', 'console_scripts', 'zotcli')() File "/usr/lib/python3.6/site-packages/click/core.py", line 722, in call return self.main(args, kwargs) File "/usr/lib/python3.6/site-packages/click/core.py", line 697, in main rv = self.invoke(ctx) File "/usr/lib/python3.6/site-packages/click/core.py", line 1066, in invoke return _process_result(sub_ctx.command.invoke(sub_ctx)) File "/usr/lib/python3.6/site-packages/click/core.py", line 895, in invoke return ctx.invoke(self.callback, ctx.params) File "/usr/lib/python3.6/site-packages/click/core.py", line 535, in invoke return callback(args, *kwargs) File "/usr/lib/python3.6/site-packages/click/decorators.py", line 17, in new_func return f(get_current_context(), args, *kwargs) File "/usr/lib/python3.6/site-packages/zotero_cli/cli.py", line 260, in edit_note note = pick_note(ctx.obj, item_id, note_num) File "/usr/lib/python3.6/site-packages/zotero_cli/cli.py", line 284, in pick_note notes = tuple(zot.notes(item_id)) File "/usr/lib/python3.6/site-packages/zotero_cli/backend.py", line 210, in notes notes = self._zot.children(item_id, itemType="note") File "/usr/lib/python3.6/site-packages/pyzotero/zotero.py", line 128, in wrapped_f retrieved = self._retrieve_data(func(self, args)) File "/usr/lib/python3.6/site-packages/pyzotero/zotero.py", line 588, in children i=item.upper()) AttributeError: 'NoneType' object has no attribute 'upper'
I get the same error.
Traceback (most recent call last):
File "/usr/bin/zotcli", line 11, in <module>
load_entry_point('zotero-cli==0.3.0', 'console_scripts', 'zotcli')()
File "/usr/lib/python3.6/site-packages/click/core.py", line 722, in __call__
return self.main(*args, **kwargs)
File "/usr/lib/python3.6/site-packages/click/core.py", line 697, in main
rv = self.invoke(ctx)
File "/usr/lib/python3.6/site-packages/click/core.py", line 1066, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "/usr/lib/python3.6/site-packages/click/core.py", line 895, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "/usr/lib/python3.6/site-packages/click/core.py", line 535, in invoke
return callback(*args, **kwargs)
File "/usr/lib/python3.6/site-packages/click/decorators.py", line 17, in new_func
return f(get_current_context(), *args, **kwargs)
File "/usr/lib/python3.6/site-packages/zotero_cli/cli.py", line 260, in edit_note
note = pick_note(ctx.obj, item_id, note_num)
File "/usr/lib/python3.6/site-packages/zotero_cli/cli.py", line 284, in pick_note
notes = tuple(zot.notes(item_id))
File "/usr/lib/python3.6/site-packages/zotero_cli/backend.py", line 212, in notes
note['data']['note'] = self._make_note(note)
File "/usr/lib/python3.6/site-packages/zotero_cli/backend.py", line 283, in _make_note
if data['version'] < note_version:
TypeError: 'NoneType' object is not subscriptable
I provided a workaround for this in #27. I tried to provide a more log term solution in #26 , but I am not competent enough in regex to know how to fix it properly. Hopefully @jbaiter can figure it out.
But you should be able to use the branch from #27 without troubles. The only side effect is that all notes will be treated as if they had been modified in the graphical zotero client, so any special markdown that is not supported there would be lost (not sure what that would include exactly).
I should say that I am also using the Zotero5 database, maybe they changed the storage format so that the regex extraction needs to be different. I don't have access to a Zotero4 database to compare.
In case it is helpful, this is what note_html
looks like at line 272 of backend.py
for me with Zotero5:
'<p>new-note-is-here</p>\n<div class="zotcli-note">\n<p id="zotcli-data" style="color: #cccccc;" title="b\'eJyrVipLLSrOzM9TslIwNDcx0VFQKkmtKAHylPJSy3Xz8ktSdTOLdTNSi1Jj8pSAsmn5RbmJYPnk\\n/Nzc/LzcxKJspVoAJ2sXHA==\\n\'">(hidden zotcli data)</p>\n</div>'
My Python version is 3.5.3.
I just merged @joelostblom's fix (thank you!). I will look into possible changes in the Zotero 5 format in the near future, sorry for keeping quiet for so long.
Confirm recent zotcli from pip and Zotero 5.0.88
query
andadd-note
work fine, but I can't I get errors withedit-note
.If I try with a search string I get the following
If I use the query ID I get the following instead