bachya / lp-vault-manager

An Alfred 2 workflow to interact with a LastPass vault.
121 stars 13 forks source link

Cannot Set Settings #5

Closed pntaylor closed 9 years ago

pntaylor commented 9 years ago

Hi,

I originally installed LPVM however had an issue and realised that it was due to me not having the LP CLI installed. I've now done this and, despite removing and re-installing the workflow I cannot set any settings. When I enter 'lpsettings' in Alfred it pauses, then wants to Google search for that rather than execute the workflow.

Any ideas?

shkm commented 9 years ago

Same problem here. It's probably erroring out.

Try clicking the debug button in the workflow's tab, which will give you an error console as shown:

alfred preferences 2015-01-07 11-24-05

Also take a look at this issue

shkm commented 9 years ago

Since I'm suffering the same problem, here's some more information.

I'm running the brand new 3.2 pre-release. Python is 2.7.9, installed via Homebrew. Yosemite 10.10.1.

Error upon running lpsettings:

[ERROR: alfred.workflow.input.scriptfilter] Code 1: Traceback (most recent call last):
  File "settings.py", line 337, in <module>
    wf.settings.setdefault(
  File "/Users/jamie/Library/Application Support/Alfred 2/Alfred.alfredpreferences/workflows/user.workflow.2E81E083-924E-42B7-BE32-A4526307F271/workflow/workflow.py", line 1378, in settings
    self._default_settings)
  File "/Users/jamie/Library/Application Support/Alfred 2/Alfred.alfredpreferences/workflows/user.workflow.2E81E083-924E-42B7-BE32-A4526307F271/workflow/workflow.py", line 802, in __init__
    self._load()
  File "/Users/jamie/Library/Application Support/Alfred 2/Alfred.alfredpreferences/workflows/user.workflow.2E81E083-924E-42B7-BE32-A4526307F271/workflow/workflow.py", line 813, in _load
    for key, value in json.load(file_obj, encoding='utf-8').items():
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/json/__init__.py", line 290, in load
    **kw)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/json/__init__.py", line 351, in loads
    return cls(encoding=encoding, **kw).decode(s)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/json/decoder.py", line 365, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/json/decoder.py", line 383, in raw_decode
    raise ValueError("No JSON object could be decoded")
ValueError: No JSON object could be decoded
bachya commented 9 years ago

Hi guys – sorry you're having troubles. I'll work with you to sort them out.

@shkm: what happens if you open Terminal and run cat ~/Library/Application\ Support/Alfred\ 2/Workflow\ Data/com.bachya.lpvm/settings.json?

shkm commented 9 years ago

Here we go. Looks quite all right to me!

Debonair :: ~ % cat ~/Library/Application\ Support/Alfred\ 2/Workflow\ Data/com.bachya.lpvm/settings.json
{
  "general": {
    "browser": 1,
    "cache_bust": 300
  },
  "lastpass": {
    "path": "/usr/local/bin/lpass",
    "username": “jamie@schembri.me”
  },
  "passwords": {
    "length": 20,
    "number": 10
  }
}% 

Debonair :: ~ % which /usr/local/bin/lpass
/usr/local/bin/lpass
bachya commented 9 years ago

Not sure what that's all about – I've published a new pre-release that may help us figure out what's going on. Try this and see if lpsettings works?

https://github.com/bachya/lp-vault-manager/releases/download/v3.2/LastPass.Vault.Manager.alfredworkflow

shkm commented 9 years ago

The error above was taken from that version, @bachya. Perhaps it's something to do with my system or something. lpass and python were installed via homebrew, whilst Alfred was installed via homebrew cask, if that helps any.

bachya commented 9 years ago

@shkm, the release number is the same, but that's actually a link to a new .alfredworkflow give (I'm choosing not to bump version numbers until I'm sure my changes are working). Try it and let me know?

shkm commented 9 years ago

Ah, fair enough!

Just gave it a shot, and unfortunately the error is still the same.

Side-track: thanks for this great workflow. Can't wait to start using it!

shkm commented 9 years ago

Oh, dear, I've found the problem. Look again at my settings.json, particularly:

 "username": “jamie@schembri.me”

The quotes are incorrect. I have no idea how this happened — I do recall editing the settings file at some point, but it's very unlikely that I'd have used anything but vim to do it, which wouldn't have inserted smart quotes.

Oh, well. It seems to be working now! Sorry to waste your time.

bachya commented 9 years ago

Great to hear, @shkm. That's a tricky one, indeed. My guess is that if you edited the file via the lpsettings command, TextEdit is to blame. Fortunately, you can prevent this rich text behavior inside the TextEdit properties:

screen shot 2015-01-09 at 11 46 33 am

I'll make sure to put a note in the README.