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

It doesn't cache contacts #10

Closed
holysock8 opened this issue Aug 24, 2017 · 19 comments
Closed

It doesn't cache contacts #10

holysock8 opened this issue Aug 24, 2017 · 19 comments

Comments

@holysock8
Copy link

Hi,

might be an obvious one, but for some reason, it isn't caching my contacts.

I followed the installation guide (download via github), but it never asked me to access my contacts.

screenshot 2017-08-24 11 06 48
screenshot 2017-08-24 11 07 00

Maybe something obvious that could be added to the install section

@deanishe
Copy link
Owner

Screenshots aren't much help. Please post the contents of the log (enter mailto workflow:openlog to view it).

@holysock8
Copy link
Author

holysock8 commented Aug 24, 2017

11:06:33 workflow.py:1778 DEBUG Loading cached data from : /Users/Robin/Library/Caches/com.runningwithcrayons.Alfred-3/Workflow Data/net.deanishe.alfred-mailto/system_default_app.cpickle
11:06:33 mailto.py:153 DEBUG Searching contacts
11:06:33 workflow.py:1778 DEBUG Loading cached data from : /Users/Robin/Library/Caches/com.runningwithcrayons.Alfred-3/Workflow Data/net.deanishe.alfred-mailto/__workflow_update_status.cpickle
11:06:33 workflow.py:2349 DEBUG update_data : {u'available': False}
11:06:33 contacts.py:43 DEBUG Updating contacts cache ...
11:06:33 background.py:180 INFO Task update-contacts is already running
11:06:33 workflow.py:2331 DEBUG Set last run version : 2.1.4
11:06:33 workflow.py:2176 DEBUG Workflow finished in 0.208 seconds.
11:06:53 workflow.py:2140 DEBUG Workflow version : 2.1.4
11:06:53 workflow.py:1543 DEBUG Reading settings from /Users/Robin/Library/Application Support/Alfred 3/Workflow Data/net.deanishe.alfred-mailto/settings.json ...
11:06:53 workflow.py:2401 DEBUG Update check not due
11:06:53 mailto.py:135 DEBUG args : Namespace(action=u'config', query=u'')
11:06:53 mailto.py:469 DEBUG Showing settings
11:06:53 mailto.py:472 DEBUG query :
11:06:53 workflow.py:1778 DEBUG Loading cached data from : /Users/Robin/Library/Caches/com.runningwithcrayons.Alfred-3/Workflow Data/net.deanishe.alfred-mailto/all_apps.cpickle
11:06:53 workflow.py:1778 DEBUG Loading cached data from : /Users/Robin/Library/Caches/com.runningwithcrayons.Alfred-3/Workflow Data/net.deanishe.alfred-mailto/system_default_app.cpickle
11:06:53 workflow.py:1778 DEBUG Loading cached data from : /Users/Robin/Library/Caches/com.runningwithcrayons.Alfred-3/Workflow Data/net.deanishe.alfred-mailto/__workflow_update_status.cpickle
11:06:53 workflow.py:2349 DEBUG update_data : {u'available': False}
11:06:53 workflow.py:2331 DEBUG Set last run version : 2.1.4
11:06:53 workflow.py:2176 DEBUG Workflow finished in 0.175 seconds.
11:14:44 background.py:180 INFO [update-contacts] job already running
11:14:54 background.py:180 INFO [update-contacts] job already running
11:14:54 background.py:180 INFO [update-contacts] job already running
11:14:56 background.py:180 INFO [update-contacts] job already running
11:14:56 background.py:180 INFO [update-contacts] job already running
11:14:57 background.py:180 INFO [update-contacts] job already running
11:14:57 background.py:180 INFO [update-contacts] job already running
11:15:03 background.py:180 INFO [update-contacts] job already running
11:15:03 background.py:180 INFO [update-contacts] job already running
11:15:12 background.py:180 INFO [update-contacts] job already running
11:15:14 background.py:180 INFO [update-contacts] job already running
11:15:14 background.py:180 INFO [update-contacts] job already running
11:15:15 background.py:180 INFO [update-contacts] job already running
11:15:15 background.py:180 INFO [update-contacts] job already running
11:15:15 background.py:180 INFO [update-contacts] job already running
11:15:15 background.py:180 INFO [update-contacts] job already running
11:15:16 background.py:180 INFO [update-contacts] job already running
11:20:35 background.py:180 INFO [update-contacts] job already running
11:20:42 workflow.py:2267 ERROR No contacts available
Traceback (most recent call last):
File "/Users/Robin/Library/Application Support/Alfred 3/Alfred.alfredpreferences/workflows/user.workflow.11F1B2D8-A855-4267-84A0-024E196317EF/workflow/workflow.py", line 2260, in run
func(self)
File "mailto.py", line 139, in run
return getattr(self, method_name)()
File "mailto.py", line 378, in do_compose
url = client.build_url(emails)
File "/Users/Robin/Library/Application Support/Alfred 3/Alfred.alfredpreferences/workflows/user.workflow.11F1B2D8-A855-4267-84A0-024E196317EF/client.py", line 221, in build_url
raise ValueError('No contacts available')
ValueError: No contacts available

@deanishe
Copy link
Owner

See #9

@holysock8
Copy link
Author

Tried that as well (after updating alfred to 3.0.1) but it hasn't changed anything

@holysock8
Copy link
Author

11:14:25 workflow.py:2527 INFO Checking for update ...
11:14:25 update.py:312 INFO retrieving releases: deanishe/alfred-fixum
11:14:26 update.py:353 INFO 9 releases for deanishe/alfred-fixum
11:14:28 fixum.py:265 INFO ==================================================
11:14:28 fixum.py:267 INFO looking for workflows using an outdated (buggy) version of Alfred-Workflow...
11:14:28 fixum.py:278 INFO workflow directory: /Users/Robin/Library/Application Support/Alfred 3/Alfred.alfredpreferences/workflows
11:14:28 fixum.py:328 INFO
11:14:28 fixum.py:329 INFO found AW workflow: user.workflow.11F1B2D8-A855-4267-84A0-024E196317EF
11:14:28 fixum.py:330 INFO name: MailTo
11:14:28 fixum.py:331 INFO bundle ID: net.deanishe.alfred-mailto
11:14:28 fixum.py:332 INFO AW version: 1.13.0
11:14:28 fixum.py:341 INFO [!!] workflow "MailTo" is using outdated version (1.13.0) of Alfred-Workflow
11:14:28 fixum.py:353 INFO
11:14:28 fixum.py:359 INFO [DONE] would update 1 workflow(s) with a newer version of Alfred-Workflow
11:14:38 fixum.py:265 INFO ==================================================
11:14:38 fixum.py:267 INFO looking for workflows using an outdated (buggy) version of Alfred-Workflow...
11:14:38 fixum.py:278 INFO workflow directory: /Users/Robin/Library/Application Support/Alfred 3/Alfred.alfredpreferences/workflows
11:14:38 fixum.py:328 INFO
11:14:38 fixum.py:329 INFO found AW workflow: user.workflow.11F1B2D8-A855-4267-84A0-024E196317EF
11:14:38 fixum.py:330 INFO name: MailTo
11:14:38 fixum.py:331 INFO bundle ID: net.deanishe.alfred-mailto
11:14:38 fixum.py:332 INFO AW version: 1.13.0
11:14:38 fixum.py:341 INFO [!!] workflow "MailTo" is using outdated version (1.13.0) of Alfred-Workflow
11:14:38 fixum.py:193 INFO updating "MailTo" ...
11:14:38 fixum.py:199 INFO installed new version of Alfred-Workflow
11:14:38 fixum.py:353 INFO
11:14:38 fixum.py:373 INFO [DONE] updated 1 workflow(s) with a newer version of Alfred-Workflow

@deanishe
Copy link
Owner

Did you kill the existing process in Activity Monitor first? It won't try to update your contacts if an update process is already running.

The current version of Alfred is 3.4.1. Please update to that.

@holysock8
Copy link
Author

sorry I meant after updating to 3.4.1.

@holysock8
Copy link
Author

I've just shut down everything and restart following the updates etc. unfortunately still no success.

@holysock8
Copy link
Author

the log shows the following error:
12:11:07 background.py:242 ERROR [update-contacts] command failed with status 1

@deanishe
Copy link
Owner

Could you open the workflow in Terminal (or iTerm) and run the update script:

/usr/bin/python update_contacts.py

@holysock8
Copy link
Author

humm.. I don't seem to have that file anywhere .. I've checked my python library and anaconda folder etc.

@deanishe
Copy link
Owner

It's in the workflow.

If you're trying to run the workflow with Anaconda, you're on your own.

Any Python but /usr/bin/python is explicitly not supported.

@holysock8
Copy link
Author

holysock8 commented Aug 24, 2017

So I do have /usr/bin/python

however when I go to iTerm and then enter /usr/bin/python update_contacts.py I get the error
/usr/bin/python: can't open file 'update_contacts.py': [Errno 2] No such file or directory

I had a look into the folder myself and cant find update_contacts.py either.

All I have done to install this workflow so far is:
download the workflow (only) - double clicked on it to install it in Alfred
then ran the fixum workflow to make it compatible.

Is there anything else I'm missing here?

@deanishe
Copy link
Owner

The file is in the workflow. You have to run the command from the workflow directory.

@holysock8
Copy link
Author

holysock8 commented Aug 24, 2017

Sorry, I'm really at a loss here at the moment.

when I install a new workflow to Alfred the additional data gets usually stored in ~/Library/Application Support/Alfred 3/Workflow Data/
Do you mean that I have to run it in there? (The mailto folder in this directory doesn't contain a "update_contacts.py" file either.

The only place I have found said file is when in addition to downloading the workflow file, I have also downloaded the source code from the repository. When I execute the "update_contacts.py" file from there, in the downloads folder, (with /usr/bin/python in Terminal) I get the following:

  1. It asks me for permission to access my contacts (I allow it)

  2. Then this (which looks like an error)
    CoreData: warning: dynamic accessors failed to find @Property implementation for 'uniqueId' for entity ABCDInfo while resolving selector 'uniqueId' on class 'ABCDInfo'. Did you remember to declare it @dynamic or @Synthesized in the @implementation ?
    19:53:05 workflow.py:2140 DEBUG Workflow version : 2.1.4
    CoreData: warning: dynamic accessors failed to find @Property implementation for 'uniqueId' for entity ABCDContact while resolving selector 'uniqueId' on class 'ABCDContact'. Did you remember to declare it @dynamic or @Synthesized in the @implementation ?
    CoreData: warning: dynamic accessors failed to find @Property implementation for 'uniqueId' for entity ABCDEmailAddress while resolving selector 'uniqueId' on class 'ABCDEmailAddress'. Did you remember to declare it @dynamic or @Synthesized in the @implementation ?
    CoreData: warning: dynamic accessors failed to find @Property implementation for 'address' for entity ABCDEmailAddress while resolving selector 'address' on class 'ABCDEmailAddress'. Did you remember to declare it @dynamic or @Synthesized in the @implementation ?
    CoreData: warning: dynamic accessors failed to find @Property implementation for 'label' for entity ABCDEmailAddress while resolving selector 'label' on class 'ABCDEmailAddress'. Did you remember to declare it @dynamic or @Synthesized in the @implementation ?
    CoreData: warning: dynamic accessors failed to find @Property implementation for 'isPrimary' for entity ABCDEmailAddress while resolving selector 'isPrimary' on class 'ABCDEmailAddress'. Did you remember to declare it @dynamic or @Synthesized in the @implementation ?

  3. followed by a list of names and email addresses like this:
    19:53:05 update_contacts.py:233 DEBUG [email protected] [email protected]
    ..

  4. some more info
    19:53:05 update_contacts.py:249 DEBUG 6 people in "Contacts"
    19:53:05 update_contacts.py:249 DEBUG 4 people in "QT Team"
    19:53:05 workflow.py:1814 DEBUG Cached data saved at : /Users/Robin/Library/Caches/com.runningwithcrayons.Alfred-2/Workflow Data/net.deanishe.alfred-mailto/contacts.cpickle
    19:53:05 update_contacts.py:262 INFO 10 people, 2 groups cached in 0.24 seconds
    19:53:05 workflow.py:1543 DEBUG Reading settings from /Users/Robin/Library/Application Support/Alfred 2/Workflow Data/net.deanishe.alfred-mailto/settings.json ...
    19:53:05 workflow.py:2331 DEBUG Set last run version : 2.1.4
    19:53:05 workflow.py:2176 DEBUG Workflow finished in 0.376 seconds.

So it does seem to find the contacts etc. (but not in the actual alfred window), probably due to the location of said "update_contacts.py" file.

Was I meant to copy the source code into the application support folder?

The only thing that does surprise me is that it seems to save all of it in Alfred 2 folders, not 3 ...

@deanishe
Copy link
Owner

Do you mean that I have to run it in there?

No. The file is part of the workflow. It's in the workflow. Open Alfred Preferences, right-click on the workflow and choose "Open in Terminal".

Then this (which looks like an error)

They're warnings, not errors.

save all of it in Alfred 2 folders

That's because you're running a non-updated version from outside Alfred.

probably due to the location of said "update_contacts.py" file.

The file is almost certainly exactly where it should be. You're looking in the wrong place.

followed by a list of names and email addresses like this
19:53:05 update_contacts.py:262 INFO 10 people, 2 groups cached in 0.24 seconds

It's working correctly.

@holysock8
Copy link
Author

No. The file is part of the workflow. It's in the workflow. Open Alfred Preferences, right-click on the workflow and choose "Open in Terminal".
-Aha, that makes more sense now!

I obviously misunderstood your previous comment:
"Could you open the workflow in Terminal (or iTerm) and run the update script" which I took as trying to open it outside of alfred as I wasn't aware that it was even possible to open worklfows with terminal from the Alfred preferences page.

Ok, so I've done that and get the following warning messages:

CoreData: warning: dynamic accessors failed to find @Property implementation for 'uniqueId' for entity ABCDInfo while resolving selector 'uniqueId' on class 'ABCDInfo'. Did you remember to declare it @dynamic or @Synthesized in the @implementation ?
CoreData: warning: dynamic accessors failed to find @Property implementation for 'uniqueId' for entity ABCDContact while resolving selector 'uniqueId' on class 'ABCDContact'. Did you remember to declare it @dynamic or @Synthesized in the @implementation ?
CoreData: warning: dynamic accessors failed to find @Property implementation for 'uniqueId' for entity ABCDEmailAddress while resolving selector 'uniqueId' on class 'ABCDEmailAddress'. Did you remember to declare it @dynamic or @Synthesized in the @implementation ?
CoreData: warning: dynamic accessors failed to find @Property implementation for 'address' for entity ABCDEmailAddress while resolving selector 'address' on class 'ABCDEmailAddress'. Did you remember to declare it @dynamic or @Synthesized in the @implementation ?
CoreData: warning: dynamic accessors failed to find @Property implementation for 'label' for entity ABCDEmailAddress while resolving selector 'label' on class 'ABCDEmailAddress'. Did you remember to declare it @dynamic or @Synthesized in the @implementation ?
CoreData: warning: dynamic accessors failed to find @Property implementation for 'isPrimary' for entity ABCDEmailAddress while resolving selector 'isPrimary' on class 'ABCDEmailAddress'. Did you remember to declare it @dynamic or @Synthesized in the @implementation ?
CoreData: warning: dynamic accessors failed to find @Property implementation for 'uniqueId' for entity ABCDGroup while resolving selector 'uniqueId' on class 'ABCDGroup'. Did you remember to declare it @dynamic or @Synthesized in the @implementation ?
CoreData: warning: dynamic accessors failed to find @Property implementation for 'uniqueId' for entity ABCDSmartGroup while resolving selector 'uniqueId' on class 'ABCDSmartGroup'. Did you remember to declare it @dynamic or @Synthesized in the @implementation ?
21:27:51 update_contacts.py:262 INFO 10 people, 2 groups cached in 0.17 seconds
Robins-MacBook-Air:user.workflow.11F1B2D8-A855-4267-84A0-024E196317EF Robin$

Following your previous comment, this is doing what it is meant to, right?

However, in my alfred window it still says the same, eg. "No contacts found"
and in the mailto log it reads (after typing @ into alfred:
21:36:00 background.py:242 ERROR [update-contacts] command failed with status 1

@deanishe
Copy link
Owner

The script appears to be working from the command-line, but not Alfred.

The obvious reason would be that you've previously denied Alfred access to your contacts.

Can you search your contacts in Alfred? Is there anything relevant in System Preferences > Security & Privacy > Privacy > Contacts?

@holysock8
Copy link
Author

OK, that has solved it!

I don't remember ever having retracted Alfred access to my contacts, but indeed that was the problem. I was waiting for mailto to ask me to grant access when installing etc., as it didn't I assumed it had access - my bad.

Thanks a lot for all the time & help - I surely have learned a thing or two how Alfred works.

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

2 participants