zjn0505/adb-alfred

Error in workflow adb: Unicode-objects must be encoded before hashing

Closed this issue · 4 comments

Hi -

I am getting the following error when using the adb command on v1.13.1:

Error in workflow adb: Unicode-objects must be encoded before hashing

image

My configuration:
image

Hi, I am not good at debugging python, so please provide more info from the debugging console.

Can you open the preference and click the top-right debug icon, and use the keyword "adb" again?

There will be more detailed error log showing there in the console below.

image

Here is the log:

[12:15:14.204] adb[[Script Filter](alfredpreferences:workflows%3Eworkflow%3Euser.workflow.8841CDCD-B084-4B9E-B73A-F6739220FAFF%3E6CC71670-241E-4E01-ADC6-0EA61C4D238C)] Queuing argument ''
[12:15:14.737] adb[[Script Filter](alfredpreferences:workflows%3Eworkflow%3Euser.workflow.8841CDCD-B084-4B9E-B73A-F6739220FAFF%3E6CC71670-241E-4E01-ADC6-0EA61C4D238C)] Script with argv '(null)' finished
[12:15:14.740] ERROR: adb[[Script Filter](alfredpreferences:workflows%3Eworkflow%3Euser.workflow.8841CDCD-B084-4B9E-B73A-F6739220FAFF%3E6CC71670-241E-4E01-ADC6-0EA61C4D238C)] Code 1: 12:15:14 list_devices.py:234 DEBUG    Hello from adb
.
12:15:14 workflow.py:2094 DEBUG    ---------- adb (1.13.1) ----------
12:15:14 workflow.py:1484 DEBUG    reading settings from /Users/aqm5181/Library/Application Support/Alfred/Workflow Data/xyz.jienan.adb/settings.json
12:15:14 workflow.py:2395 INFO     checking for update ...
12:15:14 background.py:233 DEBUG    [__workflow_update_check] command cached: /Users/aqm5181/Library/Caches/com.runningwithcrayons.Alfred/Workflow Data/xyz.jienan.adb/__workflow_update_check.argcache
12:15:14 background.py:237 DEBUG    [__workflow_update_check] passing job to background runner: ['/Applications/Xcode.app/Contents/Developer/usr/bin/python3', '-m', 'workflow.background', '__workflow_update_check']
/Applications/Xcode.app/Contents/Developer/usr/bin/python3: Error while finding module specification for 'workflow.background' (ModuleNotFoundError: No module named 'workflow')
12:15:14 background.py:241 ERROR    [__workflow_update_check] background runner failed with 1

 Execute command: /Users/aqm5181/Library/Android/sdk/platform-tools/adb devices -l | sed -n '1!p' | tr -s ' '

 Result: emulator-5554 device product:sdk_gphone_x86 model:sdk_gphone_x86 device:generic_x86_arm transport_id:1
12:15:14 list_devices.py:88 DEBUG    1 adb device(s) found

 Execute command: /Users/aqm5181/Library/Android/sdk/platform-tools/adb -s emulator-5554 shell getprop | grep 'ro.build.version.release]\|ro.build.version.sdk]\|ro.product.manufacturer]\|ro.product.model\|ro.build.display.id]\|ro.build.version.incremental]' | awk -F'[][]' -v n=2 '{ print $(2*n) }'

 Result: RSR1.201013.001
6903271
11
30
Google
sdk_gphone_x86
12:15:14 list_devices.py:27 DEBUG    getprop result for emulator-5554: ['RSR1.201013.001', '6903271', '11', '30', 'Google', 'sdk_gphone_x86']
12:15:14 workflow.py:1753 DEBUG    cached data: /Users/aqm5181/Library/Caches/com.runningwithcrayons.Alfred/Workflow Data/xyz.jienan.adb/emulator-5554-property.pickle
12:15:14 list_devices.py:99 DEBUG     emulator-5554

 Execute command: /Users/aqm5181/Library/Android/sdk/platform-tools/adb -s emulator-5554 shell ip -f inet addr show wlan0 | grep inet | tr -s ' ' |  awk '{print $2}'

 Result: 
12:15:14 workflow.py:2115 ERROR    Unicode-objects must be encoded before hashing
Traceback (most recent call last):
  File "/Users/aqm5181/Library/Application Support/Alfred/Alfred.alfredpreferences/workflows/user.workflow.8841CDCD-B084-4B9E-B73A-F6739220FAFF/scripts/workflow/workflow.py", line 2108, in run
    func(self)
  File "scripts/list_devices.py", line 227, in main
    list_devices(wf.args)
  File "scripts/list_devices.py", line 119, in list_devices
    name = hashlib.md5(item.subtitle).hexdigest()
TypeError: Unicode-objects must be encoded before hashing
12:15:14 workflow.py:2137 DEBUG    ---------- finished in 0.285s ----------
[12:15:14.745] adb[[Script Filter](alfredpreferences:workflows%3Eworkflow%3Euser.workflow.8841CDCD-B084-4B9E-B73A-F6739220FAFF%3E6CC71670-241E-4E01-ADC6-0EA61C4D238C)] {
  "items": [
    {
      "title": "Error in workflow 'adb'",
      "subtitle": "Unicode-objects must be encoded before hashing",
      "valid": false,
      "icon": {
        "path": "/System/Library/CoreServices/CoreTypes.bundle/Contents/Resources/AlertStopIcon.icns"
      }
    }
  ]
}

Can you try if v1.13.2 fix the problem?

https://github.com/zjn0505/adb-alfred/releases/tag/v1.13.2

Yes perfect that has resolved the issue. Thanks!