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

Now, MacOS 12.3 is released. Zothero cannot work on it. #70

Open
zzhanghub opened this issue Mar 15, 2022 · 23 comments
Open

Now, MacOS 12.3 is released. Zothero cannot work on it. #70

zzhanghub opened this issue Mar 15, 2022 · 23 comments

Comments

@zzhanghub
Copy link

The workflow does not work anymore due to the removal of Python 2.

@Miaoyifei-mz
Copy link

Miaoyifei-mz commented Mar 16, 2022

I reinstalled Python 2, Zothero still cannot work.

@Miaoyifei-mz
Copy link

@Miaoyifei-mz
Copy link

Miaoyifei-mz commented Mar 17, 2022

I reinstall zothero from this, it works. But zotconf don't work.

[15:08:45.332] ZotHero[Script Filter] Queuing argument ''
[15:08:45.341] ZotHero[Script Filter] Script with argv '' finished
[15:08:45.344] ERROR: ZotHero[Script Filter] Code 127: env: python: No such file or directory

@moffat
Copy link

moffat commented Mar 17, 2022

Take a look at this: https://github.com/willemml/alfred-convert#macos-123-and-later

I can make most of zothero work using the solution above. You do need to find instanced in the code where /usr/bin/python is being called directly, and change it to the pyenv version.

In order to get the copy references command to work, I had to install PyObjC in the pyenv environment I set up with pip install PyObjC

@Miaoyifei-mz
Copy link

@moffat Can you use zotconf ? I tried it your way, but still cannot use zotconf.If it's convenient, could you share your modified version? Thank you very much!

@lecoan
Copy link

lecoan commented Mar 19, 2022

@moffat Can you use zotconf ? I tried it your way, but still cannot use zotconf.If it's convenient, could you share your modified version? Thank you very much!
I had the same problem as you. It seems like a pickle version issue and I made the following change to lib/workflow/workflow.py:

          #self._cache_serializer = 'cpickle'
          self._cache_serializer = 'json'
          #self._data_serializer = 'cpickle'
          self._data_serializer = 'json'

now, zotconf works

@Miaoyifei-mz
Copy link

@lecoan Thank you! Zotconf can work by your way 😊. There is still one small problem, when I select a paper item and press command+enter or option+enter to copy the citations, citations don't appear on the clipboard. Zothero doesn't seem to be working.

@lecoan
Copy link

lecoan commented Mar 19, 2022

@lecoan Thank you! Zotconf can work by your way 😊. There is still one small problem, when I select a paper item and press command+enter or option+enter to copy the citations, citations don't appear on the clipboard. Zothero doesn't seem to be working.

I didn't meet this problem. Do you set the default style with zotconf and set the COPY_CITEKEY_MOD? when you changed the _xx_serializer, the configuration needs to be set again.

@Miaoyifei-mz
Copy link

@lecoan I set the default style with zotconf , and don't set the COPY_CITEKEY_MOD. The problem still exists.

@moffat
Copy link

moffat commented Mar 19, 2022

My understanding of the code is that copying references requires that the python environment you're using to replace the system one has 'pyobjc' installed so that it can interact with the system's pasteboard.

In my case I used 'pyenv' to make sure that package was installed.

Keep an eye on the log entries when you're running Zothero. The errors you get there should be informative.

@lecoan
Copy link

lecoan commented Mar 19, 2022

@Miaoyifei-mz Yes, pyobjc is essential for zothero, and I also modified the info.plist file in the workflow folder to use cmd+enter to copy the cite key.

    <key>COPY_CITEKEY_MOD</key>
    <string>cmd</string> 

If you still face problems, you can paste the debug log here from alfred.

@Miaoyifei-mz
Copy link

@lecoan hello, the problem still exists when I copy citations. I have installed PyObjC with pip install PyObjC, and here is the debug log:

[10:15:05.297] STDERR: ZotHero[[Run Script](alfredpreferences:workflows%3Eworkflow%3Euser.workflow.8B964301-D7F8-4370-9720-5C0072DA80B9%3EA950947F-8EA7-4749-AF55-2C7F9D6E695E)] .
10:15:05 workflow.py:2061 DEBUG    ---------- ZotHero (1.3.0) ----------
10:15:05 workflow.py:1468 DEBUG    reading settings from /Users/zhuangzhu/Library/Application Support/Alfred/Workflow Data/net.deanishe.alfred.zothero/settings.json
10:15:05 workflow.py:2343 DEBUG    update check not due
10:15:05 zh:667 DEBUG    args={'--bibliography': False,
 '--help': False,
 '--paste': False,
 '--style': None,
 '--text': None,
 '--title': None,
 '<citekey>': None,
 '<id>': u'401',
 '<key>': None,
 '<query>': None,
 '<style>': u'http://juris-m.github.io/jm-styles/jm-chinese-gb7714-2005-numeric',
 '<value>': None,
 'attachments': False,
 'citations': False,
 'clear': False,
 'config': False,
 'copy': True,
 'fields': False,
 'locale': False,
 'notify': False,
 'reindex': False,
 'search': False,
 'setvar': False,
 'style': False}
10:15:05 config.py:85 DEBUG    [config] datadir=u'/Users/zhuangzhu/Zotero'
10:15:05 core.py:72 DEBUG    [core] cachedir=u'~/Library/Caches/com.runningwithcrayons.Alfred/Workflow Data/net.deanishe.alfred.zothero'
10:15:05 core.py:73 DEBUG    [core] zotero_dir=u'~/Zotero'
10:15:05 core.py:74 DEBUG    [core] attachments_dir=None
10:15:05 workflow.py:2080 ERROR    No module named AppKit
Traceback (most recent call last):
  File "./lib/workflow/workflow.py", line 2073, in run
    func(self)
  File "./zh", line 702, in main
    args['--paste'])
  File "./zh", line 339, in do_copy
    import pasteboard as pb
  File "./lib/pasteboard.py", line 14, in <module>
    from AppKit import NSPasteboard
ImportError: No module named AppKit
10:15:05 workflow.py:2082 INFO     for assistance, see: https://github.com/deanishe/zothero/issues
10:15:05 workflow.py:2103 DEBUG    ---------- finished in 0.017s ----------

@zzhanghub
Copy link
Author

@lecoan hello, the problem still exists when I copy citations. I have installed PyObjC with pip install PyObjC, and here is the debug log:

[10:15:05.297] STDERR: ZotHero[[Run Script](alfredpreferences:workflows%3Eworkflow%3Euser.workflow.8B964301-D7F8-4370-9720-5C0072DA80B9%3EA950947F-8EA7-4749-AF55-2C7F9D6E695E)] .
10:15:05 workflow.py:2061 DEBUG    ---------- ZotHero (1.3.0) ----------
10:15:05 workflow.py:1468 DEBUG    reading settings from /Users/zhuangzhu/Library/Application Support/Alfred/Workflow Data/net.deanishe.alfred.zothero/settings.json
10:15:05 workflow.py:2343 DEBUG    update check not due
10:15:05 zh:667 DEBUG    args={'--bibliography': False,
 '--help': False,
 '--paste': False,
 '--style': None,
 '--text': None,
 '--title': None,
 '<citekey>': None,
 '<id>': u'401',
 '<key>': None,
 '<query>': None,
 '<style>': u'http://juris-m.github.io/jm-styles/jm-chinese-gb7714-2005-numeric',
 '<value>': None,
 'attachments': False,
 'citations': False,
 'clear': False,
 'config': False,
 'copy': True,
 'fields': False,
 'locale': False,
 'notify': False,
 'reindex': False,
 'search': False,
 'setvar': False,
 'style': False}
10:15:05 config.py:85 DEBUG    [config] datadir=u'/Users/zhuangzhu/Zotero'
10:15:05 core.py:72 DEBUG    [core] cachedir=u'~/Library/Caches/com.runningwithcrayons.Alfred/Workflow Data/net.deanishe.alfred.zothero'
10:15:05 core.py:73 DEBUG    [core] zotero_dir=u'~/Zotero'
10:15:05 core.py:74 DEBUG    [core] attachments_dir=None
10:15:05 workflow.py:2080 ERROR    No module named AppKit
Traceback (most recent call last):
  File "./lib/workflow/workflow.py", line 2073, in run
    func(self)
  File "./zh", line 702, in main
    args['--paste'])
  File "./zh", line 339, in do_copy
    import pasteboard as pb
  File "./lib/pasteboard.py", line 14, in <module>
    from AppKit import NSPasteboard
ImportError: No module named AppKit
10:15:05 workflow.py:2082 INFO     for assistance, see: https://github.com/deanishe/zothero/issues
10:15:05 workflow.py:2103 DEBUG    ---------- finished in 0.017s ----------

You need to make sure you install PyObjC using a specific Python environment. 🤔

path_of_your_python2 -m pip install pyobjc

@mgass
Copy link

mgass commented Mar 22, 2022

Installation of pyobjc is throwing an error for me:

ValueError: invalid literal for int() with base 10: ''

My error is similar to this bug they had 2 years ago. A parameter gets reduced to an empty string...

I have been able to use pyenv and install pypy2.7-7.3.6 to get zothero mostly working. But python2 -m pip install pyobjc fails during setup. Is anyone else seeing this? Is there a workaround?

@tophee
Copy link

tophee commented Mar 30, 2022

Check this out:

https://github.com/alfredapp/updated-third-party-python2-workflows#workflows

@Korean-David
Copy link

Will Zothero be updated to be compatible with Mac 12.3? This is one of the most frequently used workflows for me, and I'm really looking forward to its update.

@raykr
Copy link

raykr commented May 11, 2022

How to solve it in Apple Silicon M1 12.3?

@simonleandergrimm
Copy link

Flagging that this is still an issue

@giovannicoppola
Copy link

this fork is migrated to Python 3

@raykr
Copy link

raykr commented Jun 7, 2022

this fork is migrated to Python 3

[15:57:56.738] ZotHero[[Script Filter](alfredpreferences:workflows%3Eworkflow%3Euser.workflow.1C7C9D93-5CEC-44C0-966D-F294641DF6E5%3E53172C76-0F6F-4E84-8C96-D0E81629CBA4)] {
  "items": [
    {
      "title": "Error in workflow 'ZotHero'",
      "subtitle": "__str__ returned non-string (type NoneType)",
      "valid": false,
      "icon": {
        "path": "/System/Library/CoreServices/CoreTypes.bundle/Contents/Resources/AlertStopIcon.icns"
      }
    }
  ]
}

Apple Silicon M1 12.3

@kzssc
Copy link

kzssc commented Jun 7, 2022

on 12.4 and can confirm that this(https://github.com/alfredapp/updated-third-party-python2-workflows#readme) works, pay attention to footnotes 2 and 3

@giovannicoppola
Copy link

giovannicoppola commented Jun 13, 2022

@raykr the most recent version should fix this problem. let me know if you see anything else!

@alexandergogl
Copy link

@giovannicoppola thanks a lot for the fix! It works on OS 12.3.1. I am glad, that I don't need to install python 2 :)

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