abo-abo / lpy

Minimal Python IDE for GNU Emacs
186 stars 14 forks source link

name 'lp' is not defined on pspecial-lispy-eval #39

Open joshcho opened 2 years ago

joshcho commented 2 years ago

When calling pspecial-lispy-eval in certain places (variable assignment within functions), I get the following:

NameError: name ’lp’ is not defined
Traceback (most recent call last):
  File "<string>", line 19, in __PYTHON_EL_eval
  File "/home/usr/try.py", line 2, in <module>
    x = 5

Interestingly enough, the following fixes it:

(define-key lpy-mode-map (kbd "e") (lambda ()
                                       (interactive)
                                       (pspecial-lispy-eval)))

which I don't really understand why.

fanshi1028 commented 1 year ago

When calling pspecial-lispy-eval in certain places (variable assignment within functions), I get the following:

NameError: name ’lp’ is not defined
Traceback (most recent call last):
  File "<string>", line 19, in __PYTHON_EL_eval
  File "/home/usr/try.py", line 2, in <module>
    x = 5

Interestingly enough, the following fixes it:

(define-key lpy-mode-map (kbd "e") (lambda ()
                                       (interactive)
                                       (pspecial-lispy-eval)))

which I don't really understand why.

Check if lispy--python-middleware-loaded-p is t. If not, run (lispy--python-middleware-load). This solves the issues for me, hope it helps.