Jump to content

ZotHero — Generate Zotero citations in Alfred


Recommended Posts

On 6/16/2022 at 11:17 AM, giovanni said:

thanks to a github user (@Miaoyifei-mz) I was able to identify the issue (related to item notes, which I did not have in my library). @justice does the most recent version work for you? 

@giovanniI cannot believe this, the basic functionality works on M1 12.4 -- thank you so much!!! The only thing that still doesn't work is the automatic pasting of the text and it stills shows "Generating Citation" for a while if I bring up Alfred again. 

Link to comment

Thanks, @giovanni but the automatic pasting doesn't work with the latest version. It's no big deal, I just had in mind that this was how it worked in one of the previous versions before the Python update broke the workflow. @pseudometa has a paste command in his "Supercharged Citation Picker" where pasting is an option that comes up after having pressed ⌘⌥ (unfortunately, it's made for Markdown only and I'm frequently in need of italicised elements in a bibliographical entry).

So from my novice knowledge, I think one would have to implement some kind of 'paste the content of the last clipboard text to front app' option at the end of the workflow. But since I'm fine with just pressing cmd v one more time and everything works, I don't want to take any more of your time! ☺️

 

Link to comment
2 hours ago, justice said:

the automatic pasting doesn't work with the latest version.

Ok, if I understand correctly, there was no auto pasting in the python 2 version? Of course it can be added, but I am trying to determine if the migration to python 3 is completed. 

Link to comment
On 6/18/2022 at 4:56 PM, giovanni said:

Ok, if I understand correctly, there was no auto pasting in the python 2 version? Of course it can be added, but I am trying to determine if the migration to python 3 is completed. 

I am not absolutely certain, to be honest. If I remember correctly, it worked that way. Maybe @deanishe or others can briefly chime in and confirm this. The original description on GitHub lists this under "Features":

  • "Citations are copied in multiple formats, so the right data are automatically pasted into the application you're using"
Link to comment
2 hours ago, justice said:

The original description on GitHub lists this under "Features"


From my understanding of that sentence in the context of the Workflow’s description (top post), “automatically” is referring to selecting the correct pasting format without intervention, not to pasting the data immediately.

Link to comment

@Giovanni - The last two versions have given me errors, but the version before that worked. Not sure where things are going wrong - seeing this in the logs:

 

10:51:42 workflow.py:2114 ERROR    UNIQUE constraint failed: data.id
Traceback (most recent call last):
  File "lib/workflow/workflow.py", line 2107, in run
    func(self)
  File "zh.py", line 754, in main
    return do_search(query)
  File "zh.py", line 135, in do_search
    if app.stale and not running:
  File "lib/zothero/core.py", line 159, in stale
    if self.index.empty:
  File "lib/zothero/core.py", line 152, in index
    self._index.update(self.zotero)
  File "lib/zothero/index.py", line 277, in update
    if not self._update(zot, force):
  File "lib/zothero/index.py", line 405, in _update
    c.execute('INSERT INTO data VALUES (?, ?)',
sqlite3.IntegrityError: UNIQUE constraint failed: data.id
10:51:42 workflow.py:2116

Link to comment
36 minutes ago, lutefish said:

sqlite3.IntegrityError: UNIQUE constraint failed: data.id

it seems like there are duplicate entries in the database. Have you tried to delete and reinstall the Workflow? If that doesn't work, can you check the log file (ZotHero Configuration > Open Log File)? That should have more information about the last item being processed before the error. 

Link to comment
On 6/18/2022 at 4:56 PM, giovanni said:

Ok, if I understand correctly, there was no auto pasting in the python 2 version? Of course it can be added, but I am trying to determine if the migration to python 3 is completed. 

 

Thanks a lot for making this workflow functional again! It has been one of my most used workflows, saves a lot of time.

Link to comment

It worked but fail when I restart Mac. - seeing this in the logs:

 

 

ERROR    'NoneType' object has no attribute 'tags'

Traceback (most recent call last):

  File "lib/workflow/workflow.py", line 2107, in run

    func(self)

  File "zh.py", line 754, in main

    return do_search(query)

  File "zh.py", line 135, in do_search

    if app.stale and not running:

  File "lib/zothero/core.py", line 159, in stale

    if self.index.empty:

  File "lib/zothero/core.py", line 152, in index

    self._index.update(self.zotero)

  File "lib/zothero/index.py", line 277, in update

    if not self._update(zot, force):

  File "lib/zothero/index.py", line 327, in _update

    tags = u' '.join(e.tags)

AttributeError: 'NoneType' object has no attribute 'tags'

17:18:38 workflow.py:2116 INFO     for assistance, see: https://github.com/giovannicoppola/zothero/issues

17:18:38 workflow.py:2136 DEBUG    ---------- finished in 0.228s ----------

[17:18:38.210] ZotHero[Script Filter] {

  "items": [

    {

      "title": "Error in workflow 'ZotHero'",

      "subtitle": "'NoneType' object has no attribute 'tags'",

      "valid": false,

      "icon": {

        "path": "/System/Library/CoreServices/CoreTypes.bundle/Contents/Resources/AlertStopIcon.icns"

      }

    }

  ]

}

 

 

 

 

Link to comment
11 hours ago, lutefish said:

I'm suddenly getting a new error that precludes all use (with Alfred 5, so perhaps I should post it over there?) "NoneType object is not subscriptable" 

 

Let me know if you need more to figure out what's changed.

The workflow still works in Alfred 5 for me. Sometimes, however, it takes a while until "Generating Citation" disappears even after I've copied an entry.

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...