lp-vault-manager icon indicating copy to clipboard operation
lp-vault-manager copied to clipboard

lpvs fails without error

Open avallen opened this issue 10 years ago • 129 comments

Hi Aaron,

many thanks for your great work, I look forward to making extensive use of it in the future, saving me some minutes per day! :-)

Now everything seems to work fine save the most important thing: lpvs <term> does just not respond, instead it just displays "Searching vault...". Nothing is output in alfred's debug mode (set to output all information).

The data that returned from lpass export does contain non-ASCII characters, so this might be related to issue #2, testing with the 3.2 pre-release that you offer in that issue does not fix the issue however (after re-executing lpdd).

I'd be glad to provide additional debugging help if you'd like to investigate this further.

Thanks, Andreas

avallen avatar Jan 05 '15 12:01 avallen

Good morning Andreas – sorry to hear you're having trouble.

It sounds like you are able to execute `lpass export from Terminal? If so, the problem definitely lies with my side.

Could you run lpsettings within Alfred, select the 4th option ("Edit Config File"), and paste those results here?

bachya avatar Jan 05 '15 14:01 bachya

Thanks Aaron,

yes lpass export runs fine. Here is the output from "Edit Config File":

{
  "general": {
    "browser": 3, 
    "cache_bust": 300
  }, 
  "lastpass": {
    "path": "/usr/local/bin/lpass", 
    "username": "[email protected]"
  }, 
  "passwords": {
    "length": 14, 
    "number": 10
  }
}

avallen avatar Jan 05 '15 14:01 avallen

Thank you. That all looks good.

Let's go a level deeper:

  1. Open Alfred Preferences, right click on "LastPass Vault Manager", and select "Show in Finder".
  2. Open Terminal and type pythondo not hit ENTER yet.
  3. From Finder, drag lpvm.py into Terminal; this should effectively leave something like python /some/path/to/lpvm.py.
  4. At the end of that string, type search-vault "<QUERY>" – replace <QUERY> with a valid query.
    • Your Terminal should now show python /some/path/to/lpvm.py search-vault "<QUERY>".
  5. Hit ENTER.

Let me know what gets output and we'll go from there.

bachya avatar Jan 05 '15 17:01 bachya

Great instructions, thanks. The resulting output is the following:

andreas:~ $ python /Users/andreas/Dropbox/Applications/Alfred/Alfred.alfredpreferences/workflows/user.workflow.A33E58DD-49C4-46E2-8F58-846AAFA9009B/lpvm.py  search-vault yahoo
22:11:56 workflow.py:1598 DEBUG    Loading cached data from : /Users/andreas/Library/Caches/com.runningwithcrayons.Alfred-2/Workflow Data/com.bachya.lpvm/vault_items.cpickle
<?xml version="1.0" encoding="utf-8"?>
<items><item autocomplete="yahoo.com" uid="yahoo.com" valid="yes"><title>yahoo.com</title><subtitle>Click to launch; &#8984;-Click to copy password; Shift-Click to copy username.</subtitle><subtitle mod="cmd">&#8984;-Click to copy password</subtitle><subtitle mod="shift">Shift-Click to copy username</subtitle><arg>yahoo.com***https://login.yahoo.com/config/login_verify2?.intl=us&amp;.src=ygrp&amp;.done=http%3a//health.groups.yahoo.com%2Fgroup%2Fwombtwin%2Flinks%2F%3Fprop%3Deupdate</arg></item></items>22:11:56 workflow.py:2113 WARNING  Can't save last version: workflow has no version
22:11:56 workflow.py:1969 DEBUG    Workflow finished in 0.061 seconds.

Prettified:

andreas:~ $ python /Users/andreas/Dropbox/Applications/Alfred/Alfred.alfredpreferences/workflows/user.workflow.A33E58DD-49C4-46E2-8F58-846AAFA9009B/lpvm.py  search-vault yahoo
22:11:56 workflow.py:1598 DEBUG    Loading cached data from : /Users/andreas/Library/Caches/com.runningwithcrayons.Alfred-2/Workflow Data/com.bachya.lpvm/vault_items.cpickle

<?xml version="1.0" encoding="utf-8" ?>
<items>
    <item autocomplete="yahoo.com" uid="yahoo.com" valid="yes">
        <title>yahoo.com</title>
        <subtitle>Click to launch; &#8984;-Click to copy password; Shift-Click to copy username.</subtitle>
        <subtitle mod="cmd">&#8984;-Click to copy password</subtitle>
        <subtitle mod="shift">Shift-Click to copy username</subtitle>
        <arg>yahoo.com***https://login.yahoo.com/config/login_verify2?.intl=us&amp;.src=ygrp&amp;.done=http%3a//health.groups.yahoo.com%2Fgroup%2Fwombtwin%2Flinks%2F%3Fprop%3Deupdate</arg>
    </item>
</items>

22:11:56 workflow.py:2113 WARNING  Can't save last version: workflow has no version
22:11:56 workflow.py:1969 DEBUG    Workflow finished in 0.061 seconds.```

avallen avatar Jan 05 '15 21:01 avallen

Well that is very odd, indeed – that's exactly the XML I would expect. In fact, if I hardcode it into my lpvs Script Filter, I get what you'd expect:

screen shot 2015-01-05 at 3 26 22 pm

Let's try one other thing: inside the lpvs Script Filter, change:

/usr/bin/env python

...to:

python (so that the entire script reads python lpvm.py search-vault "{query}")

Any difference?

bachya avatar Jan 05 '15 22:01 bachya

Yes, after this change and a restart it now shows the following error - this time searching for google which should exist too:

3fb0d352-3f74-4783-a310-9bddb7da7900

avallen avatar Jan 05 '15 23:01 avallen

Here's some debug output that goes with it:

[ERROR: alfred.workflow.input.scriptfilter] Code 0: 00:13:40 workflow.py:1598 DEBUG    Loading cached data from : /Users/andreas/Library/Caches/com.runningwithcrayons.Alfred-2/Workflow Data/com.bachya.lpvm/vault_items.cpickle
00:13:40 workflow.py:2113 WARNING  Can't save last version: workflow has no version
00:13:40 workflow.py:1969 DEBUG    Workflow finished in 0.037 seconds.

avallen avatar Jan 05 '15 23:01 avallen

Would you be willing to share your cash to data with me? You can get the path from that Alfred debug info. It only contains URLs and host names, so there shouldn't be anything damaging to you there. Feel free to email it to me at [email protected].

bachya avatar Jan 06 '15 01:01 bachya

I'm a bit of an amateur when it comes to Terminal, but I can't seem to get past the python stage. I just get:

-bash: python/Users/mattkneale/Library/Application Support/Alfred 2/Alfred.alfredpreferences/workflows/user.workflow.9E41EC43-4013-41AA-9C2C-A21A4B5B88D7/lpvm.py: No such file or directory

EDIT: Scrap that, no space after python before dragging. Whoops! Here's what I get now:

16:04:24 workflow.py:2113 WARNING Can't save last version: workflow has no version 16:04:24 workflow.py:1969 DEBUG Workflow finished in 0.673 seconds.

ghost avatar Jan 06 '15 16:01 ghost

Thanks, Matt! Looks like I could use some better debugging info. :) Hang tight while I look into some things; I may have both you and Andreas try a pre-release build with more debugging.

bachya avatar Jan 06 '15 16:01 bachya

No problem :) Thanks for your work. FWIW I love the look of the workflow, and it's still pretty cool for generating passwords quickly on the fly so still useful even if we can't get it resolved!

ghost avatar Jan 06 '15 16:01 ghost

Appreciate that! We'll get this squashed, don't worry – I want you to experience the full benefits of this workflow. :)

Could you confirm whether your lpvs Script Filter starts with python instead of /usr/bin/env python (and whether that makes a difference)?

bachya avatar Jan 06 '15 16:01 bachya

Let's hope so!

/usr/bin/env python, and can confirm it makes no difference if I remove the /usr/bin/env.

ghost avatar Jan 06 '15 16:01 ghost

@avallen – I loaded the data you sent my into my cache and was able to query it just fine:

screen_shot_2015-01-06_at_12_18_32_pm

So, this tells me that the issue might be environmental. Still experimenting, but wanted to let you know.

bachya avatar Jan 06 '15 19:01 bachya

@avallen and @MattKneale – I've updated the 3.2 pre-release with more debugging; would you mind:

  1. installing the updated workflow (https://github.com/bachya/lp-vault-manager/releases/tag/v3.2).
  2. Re-running lpdd and posting the debug output from the Run Script action connected to it.
  3. Re-running lpvs <QUERY> and posting the debug output from the Script Filter itself.

Thanks!

bachya avatar Jan 06 '15 19:01 bachya

I tried but did not receive any debug output from lpvs and only the following line when doing lpdd - which had been there before already.

[INFO: alfred.workflow.input.keyword] Processing output 'alfred.workflow.action.script' with arg ''

Could it be that the pre-release version that is offered under the above link still points to the previous version - it says:

bachya released this 2 days ago.

avallen avatar Jan 06 '15 20:01 avallen

I'll try this later tonight/early tomorrow :) Just out at the moment. Thanks for your efforts Aaron.

On 6 January 2015 at 20:12, Andreas Vallen [email protected] wrote:

I tried but did not receive any debug output from lpvs and only the following line when doing lpdd - which had been there before already.

[INFO: alfred.workflow.input.keyword] Processing output 'alfred.workflow.action.script' with arg ''

Could it be that the pre-release version that is offered under the above link still points to the previous version - it says:

bachya released this 2 days ago.

— Reply to this email directly or view it on GitHub https://github.com/bachya/lp-vault-manager/issues/3#issuecomment-68925909 .

ghost avatar Jan 06 '15 21:01 ghost

@avallen It's the same release; I just added a different .alfredworkflow file.

That's interesting that you don't see any debug output from either; you should definitely be seeing XML and other results.

So, we've figured out that:

  1. Running the script by itself gives the correct results.
  2. No debug output or results appear when running the same script within Alfred.

Is there anything special about your environment? What version of OS X and Python are you using?

bachya avatar Jan 06 '15 22:01 bachya

No idea RE: python (can't even remember installing it; how do I find the version?)

I'm on the beta channel for Yosemite... probably should have mentioned that sooner!

On Tue, 6 Jan 2015 22:06 Aaron Bach [email protected] wrote:

@avallen https://github.com/avallen It's the same release; I just added a different .alfredworkflow file.

That's interesting that you don't see any debug output from either; you should definitely be seeing XML and other results.

So, we've figured out that:

  1. Running the script by itself gives the correct results.
  2. No debug output or results appear when running the same script within Alfred.

Is there anything special about your environment? What version of OS X and Python are you using?

— Reply to this email directly or view it on GitHub https://github.com/bachya/lp-vault-manager/issues/3#issuecomment-68942895 .

ghost avatar Jan 06 '15 22:01 ghost

No idea RE: python (can't even remember installing it; how do I find the version?)

In Terminal, run: python --version

I'm on the beta channel for Yosemite... probably should have mentioned that sooner!

Interesting... @avallen, what about you? Are you on a Yosemite beta, as well? I'm running full-fledged Yosemite... I wonder if that's a problem.

bachya avatar Jan 06 '15 23:01 bachya

Version is 2.7.6.

Yosemite is 10.10.2

On Tue, 6 Jan 2015 23:51 Aaron Bach [email protected] wrote:

No idea RE: python (can't even remember installing it; how do I find the version?)

In Terminal, run: python --version

I'm on the beta channel for Yosemite... probably should have mentioned that sooner!

Interesting... @avallen https://github.com/avallen, what about you? Are you on a Yosemite beta, as well? I'm running full-fledged Yosemite... I wonder if that's a problem.

— Reply to this email directly or view it on GitHub https://github.com/bachya/lp-vault-manager/issues/3#issuecomment-68956336 .

ghost avatar Jan 07 '15 09:01 ghost

No, I'm not on the Yosemite beta channel, instead running the regular current Yosemite version (10.10.1).

Python version in Terminal (with PATH having brew's /usr/local/bin prepended) is:

andreas:~/Downloads $ which python
/usr/local/bin/python
andreas:~/Downloads $ python --version
Python 2.7.9
andreas:~/Downloads $ brew info python
python: stable 2.7.9 (bottled), HEAD
https://www.python.org
/usr/local/Cellar/python/2.7.6 (4663 files, 73M)
  Built from source
/usr/local/Cellar/python/2.7.9 (4860 files, 79M) *
  Poured from bottle
From: https://github.com/Homebrew/homebrew/blob/master/Library/Formula/python.rb

Not sure about the python version in a launchd environment however, if alfred uses that, it might pick up the system python under /usr/bin instead.

avallen avatar Jan 07 '15 13:01 avallen

Hi Aaron,

I've installed 3.2 with no success regretfully. Could you clarify how to access the debug outputs of the scripts? Still a novice to this!

ghost avatar Jan 08 '15 09:01 ghost

@MattKneale This what you're after?

shkm avatar Jan 08 '15 10:01 shkm

Thanks @shkm

@bachya lpdd output:

[INFO: alfred.workflow.input.keyword] Processing output 'alfred.workflow.action.script' with arg ''

Nothing comes up when running lpvs

ghost avatar Jan 08 '15 10:01 ghost

Well guys, this is stumping me. Interestingly enough, I'm starting to notice it happen on my side, too: I'll type lpvs <QUERY> and nothing will show up. If I close and re-open my Alfred search, things work as expected. It's a stumper.

I'm currently working on a complete rewrite that makes it much cleaner to see where things are going on. Once it's ready, I'll report back here and would love to have you test. Assuming it continues, I'm going to exercise the nuclear option and ask the Alfred forum participants for help. :)

Stay tuned!

bachya avatar Jan 09 '15 18:01 bachya

No problem, sorry it didn't work as planned! Look forward to seeing the next version.

Best,

Matt On 9 Jan 2015 18:44, "Aaron Bach" [email protected] wrote:

Well guys, this is stumping me. Interestingly enough, I'm starting to notice it happen on my side, too: I'll type lpvs <QUERY> and nothing will show up. If I close and re-open my Alfred search, things work as expected. It's a stumper.

I'm currently working on a complete rewrite that makes it much cleaner to see where things are going on. Once it's ready, I'll report back here and would love to have you test. Assuming it continues, I'm going to exercise the nuclear option and ask the Alfred forum participants for help. :)

Stay tuned!

— Reply to this email directly or view it on GitHub https://github.com/bachya/lp-vault-manager/issues/3#issuecomment-69378793 .

ghost avatar Jan 09 '15 19:01 ghost

ALRIGHT, gentlemen – I may have implemented something that works, here (at least, for me, the issue no longer occurs). Among some other changes, I modified the updating of the vault to happen in a background process (so there's no change it'll hang on Alfred's thread).

Try the new pre-release of 4.0 and let me know?

https://github.com/bachya/lp-vault-manager/releases/tag/pre-v4.0

(I also snuck a couple of new features in there, as you might be able to tell from the release notes.)

bachya avatar Jan 10 '15 00:01 bachya

A quick comment from a:

  • Fresh Macbook owner (my first one)
  • First experience of Mac Os X
  • First experience of Alfred
  • First experience of lpvs

Now, I was experiencing both this error and the one in #2 and so far the pre-release of 4.0 has done the trick for me.

Quick note: For complete Mac beginners (like myself) it would be helpful to elaborate a little bit on the installing of the Alfred workflow itself. Being an old Linux user, the Homebrew installation of lastpass-cli was easy but I was stumped for a little while on how to install the workflow. It's always the simple stuff.

Anyway, thanks for your amazing work.

AnxiousGummi avatar Jan 10 '15 00:01 AnxiousGummi

Roger that @AnxiousGummi; when 4.0 gets officially published, I'll add some installation verbiage.

bachya avatar Jan 10 '15 02:01 bachya