tilmanginzel / alfred-bluetooth-workflow

Yet another Alfred workflow to connect / disconnect Bluetooth devices
MIT License
189 stars 8 forks source link

workflow not working #21

Closed atanasj closed 3 years ago

atanasj commented 3 years ago

The workflow suddenly stopped showing or being able to connect to any bluetooth devices.

I can restart and turn bluetooth off, etc., however no devices are shown. See below for debug error. Any help or advice would be greatly appreicated as this is/was a very helpful workflow!

[13:56:43.926] Logging Started...
[13:56:46.873] Bluetooth Connector[Script Filter] Queuing argument ''
[13:56:47.172] Bluetooth Connector[Script Filter] Script with argv '(null)' finished
[13:56:47.175] ERROR: Bluetooth Connector[Script Filter] Code 1: Traceback (most recent call last):
  File "/Users/atanas/OneDrive - University of Wollongong/PhD/__Archive/alfred/Alfred.alfredpreferences/workflows/user.workflow.8C9225C7-0B9F-4C4D-A8A6-1B6BE559DF96/alfred_bluetooth_workflow.py", line 5, in <module>
    from workflow import Workflow3
  File "/Users/atanas/OneDrive - University of Wollongong/PhD/__Archive/alfred/Alfred.alfredpreferences/workflows/user.workflow.8C9225C7-0B9F-4C4D-A8A6-1B6BE559DF96/workflow/__init__.py", line 16, in <module>
    from .workflow import Workflow, manager
  File "/Users/atanas/OneDrive - University of Wollongong/PhD/__Archive/alfred/Alfred.alfredpreferences/workflows/user.workflow.8C9225C7-0B9F-4C4D-A8A6-1B6BE559DF96/workflow/workflow.py", line 25, in <module>
    import cPickle
ModuleNotFoundError: No module named 'cPickle'
ProductName:    Mac OS X
ProductVersion: 10.15.7
BuildVersion:   19H15
Alfred: 4.3.1
alfred-bluetooth-workflow: v0.9.0

Please let me know if you need any further info. Cheers.

ksc98 commented 3 years ago

You still need help on this?

python workflow/workflow.py will return an error since cPickle is not a package in python3. But, this doesn't seem to give me any issues since the workflow works as intended for me.

If that still doesn't work, perhaps try import pickle as cPickle ?

tilmanginzel commented 3 years ago

Hi @atanasj, sorry took me a while to see this issue. I have not yet figured out how to get email notifications only for your own repositories...

I would also assume as @ksc98 that you probably switched to python 3 globally. As far as I know, Alfred workflows are still only compatible with Python 2, at least that's true for the library I am using:

So I am afraid that there is not much I can do here. :/

ksc98 commented 3 years ago

Poor wording on my part, lemme clarify:

Originally, I thought @atanasj was running the workflow with python workflow.py

When I tried this (on python 3), it also gave me the same error OP was describing.

However, for me, this doesn't matter, because invoking the workflow via Alfred works, regardless of whether one is able to execute python workflow.py

atanasj commented 3 years ago

Thanks @ksc98 and @tilmanginzel. I see on one of these above linked issues that there is a Py3 port (although not sure how to get that working). I do have Py3 enabled system wide... Any tips on how to get this workflow to use the Py2 shipped with my OS?

ksc98 commented 3 years ago

@atanasj, any particular reason you are trying to get it working with python2? I am using python3 globally on my system, and the workflow works as intended. Are you saying you can't get the workflow to work at all?

atanasj commented 3 years ago

@ksc98, no, I would prefer to have Python3, but I thought that was the problem. If I can get it working with Py3 only, that would be great, as I have Py3 enables system wide. I enable/disable/restart/toggle, but that's it. No BT devices are visbile, and they were before. Any ideas about what to do to get this working again?

tilmanginzel commented 3 years ago

Hi @atanasj, do you still have python 2 available on your system somewhere? If yes, you should be able to use a simple workaround:

grafik
atanasj commented 3 years ago

Okay... I honestly do not know what has happened, but I went to reinstall the workflow, and it is now working as expected. Super strange and I do not know what has happened at all. As this is no longer an issue (and probably a user generated one), I'll close the issues. Thanks for the feedback and guidance.

tilmanginzel commented 3 years ago

Very glad to hear that it's working again @atanasj, even though the root cause is still unclear! :)

Please feel free to reopen (or create a new one) when the issue comes up again.

atanasj commented 3 years ago

Ha... So, I'm spontaneously getting the same error again!

tilmanginzel commented 3 years ago

I still feel like this somehow has to be related to your local setup with Python 2 / Python 3. Can you check what I wrote in https://github.com/tilmanginzel/alfred-bluetooth-workflow/issues/21#issuecomment-778825275 and point the workflow to a Python 2 executable? Maybe this results in a stable workaround, with the downside that future workflow updates might break again for you. Additionally, I could also think about adding the possibility to provide a workflow environment variable, which sets an optional path to a proper python exectuable. This would be stable across updates then.

Currently, the workflow itself can only rely on the python version provided by MacOS. And (unfortunately), this must be python 2 due to the workflow dependency. You can verify your default version in a terminal via python --version, which ideally prints 2.7.16. If it prints 3.x, the workflow must be pointed to a python 2 executable.

atanasj commented 3 years ago

Thanks @tilmanginzel. My default python version is Python 3.9.0. But, alas, the workflow is working again. If it's okay, I'll leave the issue open for another week and if I continue to experience issues then I'll report back. I'm not too sure how a workflow environment variable would work, but that could be a good solution in my use case (if it is related to the python version).

tilmanginzel commented 3 years ago

Yeah we can keep this open for now. The environment variable would be a possibility for the user to set a path to a python 2 executable. If it is not set, the workflow could just use python as a fallback.

tilmanginzel commented 3 years ago

Hey @atanasj, just checking if there have been any issues lately? :)

atanasj commented 3 years ago

Hey @tilmanginzel, funny you should ask. It was working great, and then stopped again. I haven't had a time to restart to see if that fixes the problem as I'm currently running some analyses, but I will and get back again.

tilmanginzel commented 3 years ago

Hi @atanasj, not trying to be annoying but is there an update on this? I'm inclined to close the issue, as the title "workflow not working" can be a bit off-putting at first glance. It seems to be an isolated edge-case, possibly related to an incompatible python version.

atanasj commented 3 years ago

Hi. Sorry, I should have given an update... It seems to be writing without issue, so this could be closed. Thanks again @tilmanginzel.

tilmanginzel commented 3 years ago

No worries, good to hear it's working for now!