Jump to content

ZotQuery: an Alfred workflow for Zotero


Recommended Posts

Well that is the issue. We now need to figure out why. Can you run both `config_zotero-api.scpt` and `config_export-prefs.scpt` and tell me the errors. Also, delete `first-run.txt`, 'paths.json`, 'prefs.json`, and `settings.json`. Then re-run the configurator. Do all the AS dialog boxes pop up? The one for Python dependencies? The one's for the Zotero API data? and the ones for your Export Preferences?

Link to comment

Deleted "first-run.txt", "paths.json", "prefs.json" and "settings-json".

 

Here the output of the two scripts:

Config_zotero-api.scpt:

error "Datei enthält kein Symbol" number -50 from alias "Pundarika:Users:amw:Library:Application Support:Alfred 2:Alfred.alfredpreferences:workflows:user.workflow.C3173E80-7D18-4B4D-8F9B-DCC3E70D81D5:icons:ZotQuery.png" to number or string

 

config_export-prefs.scpt:

error "Datei enthält kein Symbol" number -50 from alias "Pundarika:Users:amw:Library:Application Support:Alfred 2:Alfred.alfredpreferences:workflows:user.workflow.C3173E80-7D18-4B4D-8F9B-DCC3E70D81D5:icons:ZotQuery.png" to number or string

 

Finally ran z:config. No dialogues show up though after 10 secs I get the confirmation dialogue stating "Success cache settings!" and the three deleted 0 byte files are back in place. None of the dialogues (python dependencies, Zotero's API or the Export prefs) show up.

Edited by kithairon
Link to comment

The init file is supposed to be empty, so that's not a problem. Its an odd error. I just uploaded a new version to Packal. Update ZotQuery. Delete the paths, settings, and prefs files. Then debug these steps again and report the errors. I tried to add better handling in this new version to find the specific bug more easily.

Link to comment

Downloaded and updated Zotquery. Deleted the paths, settings and prefs files.

config_zotero-api.scpt:

"Datei enthält kein Symbol"  ("file does not contain any symbol")

 

config_export-prefs.scpt:

"Datei enthält kein Symbol"

 

Did I miss something?

Edited by kithairon
Link to comment

No. I'm clearly missing something, but the combination of AS poor error reporting and my complete non-understanding of what an error saying that a .jpg doesn't have a "symbol" means is blocking the way forward. Simple solution tho: I will add the ability to show simple dialog boxes (no icon) if an error occurs. I'll post when I update.

Link to comment

Something is moving. Re-installed 4.5. z:config gives me "no user interaction allowed. Cache success"; z:cache "cache success!" and z:settings is not responsive. When triggered manually config_export-prefs.scpt and config_zotero-api.scpt run beautifully. I configured them both (MLA and rtf output) When I search for an author an chose export reference I get a message in my notifications »Citation copied! Format: Traceback (most recent call last): File "action_export-citation.py", line 6, in <module> from dependencies. pyzotero i..." the rest is cut off and I don't know where to find the complete entry that goes into my notifications. Let me know if I can do anything else.

Link to comment

Open the `action.log` file in the workflow folder. That should contain the full error. Also try opening Notification Center. The error occurs when attempting to import the pyzotero module, which is what is used to generate the citations and references. 

 

I'm a bit confused though as to the "no user interaction allowed." If the config scripts run when you manually run them, but not from the workflow, there must be some setting or preference on your machine that is killing them. I honestly have no idea what's up with that. 

 

See if you can find the error message, I'll investigate the import problem.

Link to comment

Here the action.log:

Traceback (most recent call last):
  File "action_export-citation.py", line 6, in <module>
    from dependencies.pyzotero import zotero
  File "/Users/amw/Library/Application Support/Alfred 2/Alfred.alfredpreferences/workflows/user.workflow.93503EDD-ECE5-47D5-BF9A-02C39A1A2BA6/dependencies/pyzotero/zotero.py", line 45, in <module>
    import feedparser
ImportError: No module named feedparser

 

The config scripts work if I open them manually and run them with the script editor's run function.

 

I'll see whether I can install Zotero and ZotQuery on a second machine to compare.

Edited by kithairon
Link to comment

Installed ZotQuery on my second machine (Maverick – the first is Mountain Lion). The scripts respond to z:config and z:settings as expected. When exporting a reference I get the exact same message in the action log as above. Despite the output (citation copied to clipboard) this does not actually happen.

Link to comment

"as expected" means that the z:config and z:setting are working properly on the Mavericks machine? If so, I honestly have no idea what the problem is with the Mountain Lion machine. 

 

As to the problem on export, I've had a few people have similar issues. The configurator is supposed to install any Python dependencies, but with the error on the Mountain Lion machine, that script wasn't working. Rather than continue to deal with such things, I've actually just decided to bundle the two most commonly missing packages (pytz and feedparser) with the pyzotero module, which is packaged with the workflow. This means that the workflow no longer looks to your Python distribution to find these modules, but will pick them up from within the workflow. This should fix your issue. I've just uploaded the new version (4.6) to Packal. Update, then let me know how things go. 

Link to comment

Thanks for your efforts. Re the Maverick machine: yes, the z:config invokes the config script, the z:settings the export script – I believe expected behaviour.

Updated to 4.6 on the 10.8.5 machine.

Upon running the z:settings, the action log states:

config_export-prefs.scpt: execution error: No user interaction allowed. (-1713)

The ecport citation outputs this in the action.log:

Traceback (most recent call last):
  File "action_export-ref.py", line 5, in <module>
    from dependencies.pyzotero import zotero
  File "/Users/amw/Library/Application Support/Alfred 2/Alfred.alfredpreferences/workflows/user.workflow.93503EDD-ECE5-47D5-BF9A-02C39A1A2BA6/dependencies/pyzotero/zotero.py", line 54, in <module>
    from requests_dir import requests
ImportError: No module named requests_dir

 

Started with a pristine new user profile (on ML); no luck with scripts – they can be manually triggered but not otherwise. The export citations produces the same error as in my main user-profile.
 

Link to comment

I will need to research this "No user interaction allowed" error. This is new to me. However, the other error is fixed. It was a silly mistake on my part (sorry), but the new code is up on Packal (v. 4.7). That should solve the exporting issues for good. 

 

As I said, I will see what I can find about the other issue. It appears that something isn't allowing AS dialogs to run. Never seen this before. If anyone has any knowledge on this, I'd love to know. 

Link to comment

Ok. I think I've fixed the AS dialog problem. Apparently, AS sometimes won't allow scripts to display dialog boxes on their own. So, I've wrapped all dialogs in tell blocks to the Finder. This should ensure that they appear. I've just updated to Packal (v. 4.8). Try it out and let me know.

Link to comment

Great. I'm delighted to report that the dialogues are now showing up since 4.8 and z:config and z.settings work nicely. Open attachment attachment works a treat now. I've actually started *using* Zotquery to interact with my Zotero db.

When using the "export reference" function I still get no reference in my clipboard and this in the action log:
Traceback (most recent call last):
  File "action_export-citation.py", line 6, in <module>
    from dependencies.pyzotero import zotero
  File "/Users/amw/Library/Application Support/Alfred 2/Alfred.alfredpreferences/workflows/user.workflow.069AB234-E6B0-4354-B204-D3381AEF38D6/dependencies/pyzotero/zotero.py", line 55, in <module>
    from pytz_dir import pytz
  File "/Users/amw/Library/Application Support/Alfred 2/Alfred.alfredpreferences/workflows/user.workflow.069AB234-E6B0-4354-B204-D3381AEF38D6/dependencies/pyzotero/pytz_dir/pytz/__init__.py", line 38, in <module>
    from deps.tzinfo import unpickler
  File "/Users/amw/Library/Application Support/Alfred 2/Alfred.alfredpreferences/workflows/user.workflow.069AB234-E6B0-4354-B204-D3381AEF38D6/dependencies/pyzotero/pytz_dir/pytz/deps/tzinfo.py", line 10, in <module>
    import pytz
ImportError: No module named pytz

And correspondingly for export bibiography ( I chose on of my collections) this:

Traceback (most recent call last):
  File "action_export-coll-tag-bib.py", line 6, in <module>
    from dependencies.pyzotero import zotero
  File "/Users/amw/Library/Application Support/Alfred 2/Alfred.alfredpreferences/workflows/user.workflow.069AB234-E6B0-4354-B204-D3381AEF38D6/dependencies/pyzotero/zotero.py", line 55, in <module>
    from pytz_dir import pytz
  File "/Users/amw/Library/Application Support/Alfred 2/Alfred.alfredpreferences/workflows/user.workflow.069AB234-E6B0-4354-B204-D3381AEF38D6/dependencies/pyzotero/pytz_dir/pytz/__init__.py", line 38, in <module>
    from deps.tzinfo import unpickler
  File "/Users/amw/Library/Application Support/Alfred 2/Alfred.alfredpreferences/workflows/user.workflow.069AB234-E6B0-4354-B204-D3381AEF38D6/dependencies/pyzotero/pytz_dir/pytz/deps/tzinfo.py", line 10, in <module>
    import pytz
ImportError: No module named pytz

 

Have yet to play with the new attchment function – great idea!

Link to comment

Argghh.... To be honest, all these Python dependencies are frustrating me. Trying to wrap them into the workflow just isn't working. Honestly, the best solution is to install them on your machine, which is what the first step of the configurator is trying to do. When you run the config script, does a dialog appear that says all Python dependencies are installed? Or what does it say? I think I'm going to give up trying to wrap these modules in the workflow (I can't figure it out), and have people manually install if the configurator doesn't work. But if the config script isnt working, I'd like to know. 

 

So for now, re-configure and let me know what the install-python-dependencies script says. From there, I can tell you how to install the two necessary modules manually.

Link to comment

Deleted path.json, prefs.json, settings.json and first.run.txt. Then ran z:config and responded to the dialogues for setting paths, the Zotero API key and my user number, then the export options. After a short while the notification panel states "Cache succes!" At no stage do I have any feedback about the config_install-python-dependencies.py. I have a sense that it is not running at all. Action.log says nothing.

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...