tpope / vim-fireplace

fireplace.vim: Clojure REPL support
https://www.vim.org/scripts/script.php?script_id=4978
1.75k stars 139 forks source link

Evaluating incorrect clojure form causes python error instead of printing stack trace #276

Closed DKuykendall closed 5 years ago

DKuykendall commented 8 years ago

Any time I try to evaluate clojure code that is incorrect, instead of a stack trace, I receive "Vim(python): Traceback (most recent call last):". Looking for a solution to this, I found issue #234, where tpope's comment on the weird error truncation led me to change nrepl_fireplace.py, but the weird truncated error is still present

bhurlow commented 7 years ago
(clojure.core/require 'mock :reload)
Error detected while processing function <SNR>27_Require[13]..fireplace#session_eval[16]..fireplace#quickfix_for[2]..<SNR>27_qfmassage[13]..fireplace#findresource[12]..fireplace#jar_contents:
line   14:
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/usr/local/Cellar/python/2.7.13/Frameworks/Python.framework/Versions/2.7/lib/python2.7/zipfile.py", line 6, in <module>
    import io
  File "/usr/local/Cellar/python/2.7.13/Frameworks/Python.framework/Versions/2.7/lib/python2.7/io.py", line 51, in <module>
    import _io
ImportError: dlopen(/usr/local/Cellar/python/2.7.13/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-dynload/_io.so, 2): Symbol not found: __PyCodecInfo_GetIncrementalDecoder
  Referenced from: /usr/local/Cellar/python/2.7.13/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-dynload/_io.so
  Expected in: flat namespace
 in /usr/local/Cellar/python/2.7.13/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-dynload/_io.so
withrocks commented 7 years ago

For what it's worth: I got this error too when running 265fc95 of vim-fireplace on vim version 7.4 (MacOS) installed with homebrew. But upgrading vim to 8.0 fixed it in my case.

bhurlow commented 5 years ago

re-installing vim via homebrew (and thus python) fixed this for me as well

tpope commented 5 years ago

The full error is now available at g:fireplace_last_python_exception. I believe this particular issue is fixed.

bakku commented 5 years ago

Sadly I'm still getting this..After evaluating some incorrect code I get:

Vim(python):Traceback (most recent call last):

and

:echo g:fireplace_last_python_exception

results in:

E121: Undefined variable: g:fireplace_last_python_exception
E15: Invalid expression: g:fireplace_last_python_exception

The latest commit of the fireplace plugin locally is: https://github.com/tpope/vim-fireplace/commit/e289d119906796550beedc133419109820b05bda

I'm running vim 8 on Mac OS and I have Python 2.7

Any ideas how to debug?

tpope commented 5 years ago

Can you reproduce the issue if you do :let $FIREPLACE_NO_IF_PYTHON = 1 first?

bakku commented 5 years ago

If I do that, then I can see the actual exception, cool thanks !

Do I have to add this to my .vimrc ?

tpope commented 5 years ago

Okay, so the issue isn't with retrieving the stacktrace as i initially assumed but with finding the entries in the jar files in your classpath. e79ea15d9d3b827542fd139a08ca77d745644438 should fix it.

That variable is a backdoor for debugging, do not add it to your vimrc.

bakku commented 5 years ago

I updated the plugin locally so now I have def51d30284fbd52b8b70cf931bf9927eefe4088 on my local machine, sadly I still get a somewhat similar error as before:

Vim(pythonx):Traceback (most recent call last):

Again executing:

:let $FIREPLACE_NO_IF_PYTHON = 1

solves the problem.

tpope commented 5 years ago

What happens if you do :pythonx import zipfile?

bakku commented 5 years ago

I get this error:

Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/usr/local/Cellar/python/2.7.14/Frameworks/Python.framework/Versions/2.7/lib/python2.7/zipfile.py", line 6, in <module>
    import io
  File "/usr/local/Cellar/python/2.7.14/Frameworks/Python.framework/Versions/2.7/lib/python2.7/io.py", line 51, in <module>
    import _io
ImportError: dlopen(/usr/local/Cellar/python/2.7.14/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-dynload/_io.so, 2): Symbol not found: __PyCodecInfo_GetIncrementalDecoder
  Referenced from: /usr/local/Cellar/python/2.7.14/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-dynload/_io.so
  Expected in: flat namespace
 in /usr/local/Cellar/python/2.7.14/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-dynload/_io.so
tpope commented 5 years ago

Your Vim is broken, try reinstalling it. I'll try to make Fireplace robust against this case.

bakku commented 5 years ago

You are right, after reinstalling it works ! Thanks for your help and patience :+1: