neilagabriel / vim-geeknote

Vim plugin for Geeknote
233 stars 16 forks source link

ImportError: No module named geeknote.out #12

Closed MrMaksimize closed 10 years ago

MrMaksimize commented 10 years ago

Just trying to get this running in my vim, and when I run

vim -c Geeknote, I get:

Error detected while processing function Vim_GeeknoteToggle:
line    4:
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/Users/MrMaksimize/.vim_runtime/sources_non_forked/vim-geeknote/plugin/vim_geeknote.py", line 4, in <module>
    from explorer import Explorer
  File "/Users/MrMaksimize/.vim_runtime/sources_non_forked/vim-geeknote/plugin/explorer.py", line 5, in <module>
    from view  import *
  File "/Users/MrMaksimize/.vim_runtime/sources_non_forked/vim-geeknote/plugin/view.py", line 4, in <module>
    from enml  import *
  File "/Users/MrMaksimize/.vim_runtime/sources_non_forked/vim-geeknote/plugin/enml.py", line 5, in <module>
    from geeknote.out import *
ImportError: No module named geeknote.out

I'm terribly bad at python -- would love to know what's going on. Thanks!

Great and SUPER useful project by the way!

neilagabriel commented 10 years ago

Thanks. This looks like an installation issue. A few questions:

  1. Does the plugin work when invoked from within Vim (:Geeknote)?
  2. Are you able to invoke the Geeknote CLI utilitiy from the command-line (e.g. geeknote login)?
MrMaksimize commented 10 years ago

Hi Neil! Thanks for responding. The result is the same when I run :Geeknote inside of vim. And I'm also able to invoke the Geeknote CLI.

I did a bit of debugging last night, and found that when I print my sys.path from vim_geeknote.vim the list of paths I get is much shorter than when I print them from the regular REPL from within the terminal. It doesn't seem to include homebrew Python paths only the paths to /Library/Python.

So I'm wondering if it's just a path or environment issue but I'm stumped on how to fix or debug it.

Thanks so much again!

neilagabriel commented 10 years ago

Unfortunately, I don't have a mac that I can test this on. You're on the right track though. The error is definitely indicating that python cannot find the geeknote python modules. You may find this information helpful:

Python Module Search Path

It's not really what I would recommend, but the most obvious brute force workaround may just be to copy the geeknote modules into the vim-geeknote installation directory (e.g. vim-geeknote/plugin/geeknote/geeknote.out, ...).

I also found this:

https://github.com/Lokaltog/powerline/issues/344

It seems related. I'll study that issue more.

neilagabriel commented 10 years ago

Something else you may want to try would be add the following at the top of your vim-geeknote.vim file:

python sys.path.append('/usr/local/lib/python2.7/dist-packages/geeknote-0.2a-py2.7.egg/')

You'll have to adapt that based on your setup. It's obviously not a good long-term fix, but it would interesting to know if that works.

MrMaksimize commented 10 years ago

Huh. this is super weird.

My guess is it's somehow related homebrew, and maybe me screwing around with Python in my os before. But I got it resolved in a really dirty way.

I took the paths I was seeing in the REPL and just exported them into the $PYTHONPATH variable.

Looks like this now:

export PYTHONPATH=/usr/local/Cellar/python/2.7.8_2/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages:/Library/Python/2.7/site-packages:/usr/local/lib/python2.7/site-packages:/Users/MrMaksimize/bin:/Users/MrMaksimize/.vim_runtime/sources_non_forked/vim-geeknote/plugin:/usr/local/Cellar/python/2.7.8_2/Frameworks/Python.framework/Versions/2.7/lib/python27.zip:/usr/local/Cellar/python/2.7.8_2/Frameworks/Python.framework/Versions/2.7/lib/python2.7:/Library/Python/2.7/site-packages:/usr/local/lib/python2.7/site-packages:/usr/local/Cellar/python/2.7.8_2/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-darwin:/usr/local/Cellar/python/2.7.8_2/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-mac:/usr/local/Cellar/python/2.7.8_2/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-mac/lib-scriptpackages:/usr/local/Cellar/python/2.7.8_2/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-tk:/usr/local/Cellar/python/2.7.8_2/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-old:/usr/local/Cellar/python/2.7.8_2/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-dynload:$PYTHONPATH

And then it worked. It's almost like vim is it's own python environment.

Thanks so much for your help! I'll let you close it in case you had another comment or maybe know why it's going on :)

neilagabriel commented 10 years ago

Weird indeed. Perhaps someday I'll get a mac to play on. Thanks for digging into it. I'll know what to suggest now if anyone else runs into the issue.

itbrian commented 10 years ago

I encountered this same issue. The root cause was a combination of Mac Ports options and not being careful between the OS python and the Mac Ports python. The cleanest solution was to do the following:

Install the Mac Ports python: port install python27 port select --set python python27 port install py-pip27 port select --set pip pip27

Install the Mac Ports vim with python enabled: port install vim +huge +python27

Install and configure Geeknote using the Mac Ports python cd ; /opt/local/bin/python setup.py install

From this point on, vim-geeknote worked like a charm on Mac OS X (Yosemite) without the previous errors.

neilagabriel commented 10 years ago

Thank you for sharing. I will add this to the README.

On Thu, Nov 6, 2014 at 7:41 PM, Brian Zaugg notifications@github.com wrote:

I encountered this same issue. The root cause was a combination of Mac Ports options and not being careful between the OS python and the Mac Ports python. The cleanest solution was to do the following:

Install the Mac Ports python: port install python27 port select --set python python27 port install py-pip27 port select --set pip pip27

Install the Mac Ports vim with python enabled: port install vim +huge +python27

Install and configure Geeknote using the Mac Ports python cd ; /opt/local/bin/python setup.py install

From this point on, vim-geeknote worked like a charm on Mac OS X (Yosemite) without the previous errors.

— Reply to this email directly or view it on GitHub https://github.com/neilagabriel/vim-geeknote/issues/12#issuecomment-62083333 .

adamalbrecht commented 10 years ago

Yeah I can't get it to work on my mac either. I tried with both the built-in python and the homebrew version.

scottbaron commented 9 years ago

Neilagabriel - when I first installed GEEKNOTE (2 weeks ago) I was able to operate it from the command line. Now I get the following error.

➜  ~/.vim/bundle/vim-geeknote/syntax   master  geeknote settings Traceback (most recent call last): File "/usr/local/bin/geeknote", line 9, in load_entry_point('geeknote==0.2a0', 'console_scripts', 'geeknote')() File "build/bdist.macosx-10.6-x86_64/egg/pkg_resources/init.py", line 519, in load_entry_point File "build/bdist.macosx-10.6-x86_64/egg/pkg_resources/init.py", line 2630, in load_entry_point File "build/bdist.macosx-10.6-x86_64/egg/pkg_resources/init.py", line 2310, in load File "build/bdist.macosx-10.6-x86_64/egg/pkg_resources/init.py", line 2316, in resolve ImportError: No module named geeknote ✘ ➜  ~/.vim/bundle/vim-geeknote/syntax   master 

However I am able to run geeknote within vim. Any suggestions on how to debug this. Again thank you very much.