Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

deffered error : (error "\"AssertionError()\"") #332

Open
Muldfox opened this issue Jan 29, 2019 · 9 comments
Open

deffered error : (error "\"AssertionError()\"") #332

Muldfox opened this issue Jan 29, 2019 · 9 comments

Comments

@Muldfox
Copy link

Muldfox commented Jan 29, 2019

SOLVED - Look at the comment down below on how I managed to "fix" my issue.

OS: Windows 10 Pro (Version: 1809, OS Build 17763.292)
Python version: 3.6.7
Emacs version: 26.1
Jedi PIP version: 0.2.7
Jedi MELPA version: 0.13.2

I'm having some oddities with Jedi where when I'm inside a python file (this one in particular has around 200 lines of code), Jedi will give me the completion box/menu after dots, but only in the first lines. When I go to around line 180, all of a sudden the completion/suggestion menu won't appear after dot. That is when I get deffered error : (error "\"AssertionError()\"").

So basically, around line 1-50, I get the completion menu with all kinds of suggestions (that I haven't even used in the file). But around line 180 no menu pops up, and that's where I get the AssertionError.

I pulled up the epc buffer and it just keeps telling me: ERROR:epc:AssertionError().

Example in the beginning of the file where it works:
https://i.imgur.com/q2Oohd7.png

Example further down in the file where it doesn't work:
https://i.imgur.com/Frqw2kQ.png

I have tried re-installing the jedi-server to no avail. It gives the same exact results.
I am really new to emacs, so I'm obviously doing something wrong here.

Here is my init.el file, for reference:
https://pastebin.com/bF3svCkw

Here is the jedi setup info (jedi:show-setup-info):

;; Emacs Lisp version:
(:emacs-version "26.1" :jedi-version "0.2.7" :python-environment-version "0.0.2alpha0")
;; Python version:
((:name "sys" :file nil :version "3.6.7 (v3.6.7:6ec5cf24b7, Oct 20 2018, 13:35:33) [MSC v.1900 64 bit (AMD64)]")
 (:name "jedi" :file "c:\\Users\\xxxxx\\AppData\\Local\\Programs\\Python\\Python36\\lib\\site-packages\\jedi\\__init__.py" :version "0.13.2")
 (:name "epc" :file "c:\\Users\\xxxxx\\AppData\\Local\\Programs\\Python\\Python36\\lib\\site-packages\\epc\\__init__.py" :version "0.0.5")
 (:name "sexpdata" :file "c:\\Users\\xxxxx\\AppData\\Local\\Programs\\Python\\Python36\\lib\\site-packages\\sexpdata.py" :version "0.0.3"))
;; Command line:
(:virtualenv "c:/Users/xxxxx/AppData/Local/Programs/Python/Python36/python.exe" :virtualenv-version "Python 3.6.7\n")
;; Customization:
((jedi:complete-on-dot . t)
 (jedi:doc-display-buffer . display-buffer)
 (jedi:doc-hook view-mode)
 (jedi:doc-mode . rst-mode)
 (jedi:environment-root)
 (jedi:environment-virtualenv)
 (jedi:get-in-function-call-delay . 1000)
 (jedi:get-in-function-call-timeout . 3000)
 (jedi:goto-definition-config
  (nil nil nil)
  (t nil nil)
  (nil definition nil)
  (t definition nil)
  (nil nil t)
  (t nil t)
  (nil definition t)
  (t definition t))
 (jedi:goto-definition-marker-ring-length . 16)
 (jedi:imenu-create-index-function . jedi:create-nested-imenu-index)
 (jedi:import-python-el-settings . t)
 (jedi:install-imenu)
 (jedi:install-python-jedi-dev-command "pip" "install" "--upgrade" "git+https://github.com/davidhalter/jedi.git@master#egg=jedi")
 (jedi:key-complete .
		    [C-tab])
 (jedi:key-goto-definition .
			   [67108910])
 (jedi:key-goto-definition-pop-marker .
				      [67108908])
 (jedi:key-related-names . "�r")
 (jedi:key-show-doc . "�d")
 (jedi:server-args)
 (jedi:server-command "c:/Users/xxxxx/.emacs.d/.python-environments/default/Scripts/jediepcserver.exe")
 (jedi:setup-keys . t)
 (jedi:tooltip-method pos-tip popup)
 (jedi:use-shortcuts)
 (python-environment-default-root-name . "default")
 (python-environment-directory . "~/.emacs.d/.python-environments")

I'm sorry if I forgot some important information. If needed I'll update as fast as possible.

@Muldfox
Copy link
Author

Muldfox commented Jan 29, 2019

So, I finally got it to work! I downgraded Jedi to version 0.11.0 inside of the environment.

pip install Jedi==0.11.0 inside of the environment did the trick. Not sure what the exact issue was, but it's working now.

Jedi:show-setup-info in working condition:

;; Emacs Lisp version:
(:emacs-version "26.1" :jedi-version "0.2.7" :python-environment-version "0.0.2alpha0")
;; Python version:
((:name "sys" :file nil :version "3.6.7 (v3.6.7:6ec5cf24b7, Oct 20 2018, 13:35:33) [MSC v.1900 64 bit (AMD64)]")
 (:name "jedi" :file "c:\\users\\xxxxx\\.emacs.d\\.python-environments\\default\\lib\\site-packages\\jedi\\__init__.py" :version "0.11.0")
 (:name "epc" :file "c:\\users\\xxxxxx\\.emacs.d\\.python-environments\\default\\lib\\site-packages\\epc\\__init__.py" :version "0.0.5")
 (:name "sexpdata" :file "c:\\users\\xxxxx\\.emacs.d\\.python-environments\\default\\lib\\site-packages\\sexpdata.py" :version "0.0.3"))
;; Command line:
(:virtualenv "c:/Users/xxxxxx/AppData/Local/Programs/Python/Python36/python.exe" :virtualenv-version "Python 3.6.7\n")
;; Customization:
((jedi:complete-on-dot . t)
 (jedi:doc-display-buffer . display-buffer)
 (jedi:doc-hook view-mode)
 (jedi:doc-mode . rst-mode)
 (jedi:environment-root)
 (jedi:environment-virtualenv)
 (jedi:get-in-function-call-delay . 1000)
 (jedi:get-in-function-call-timeout . 3000)
 (jedi:goto-definition-config
  (nil nil nil)
  (t nil nil)
  (nil definition nil)
  (t definition nil)
  (nil nil t)
  (t nil t)
  (nil definition t)
  (t definition t))
 (jedi:goto-definition-marker-ring-length . 16)
 (jedi:imenu-create-index-function . jedi:create-nested-imenu-index)
 (jedi:import-python-el-settings . t)
 (jedi:install-imenu)
 (jedi:install-python-jedi-dev-command "pip" "install" "--upgrade" "git+https://github.com/davidhalter/jedi.git@master#egg=jedi")
 (jedi:key-complete .
		    [C-tab])
 (jedi:key-goto-definition .
			   [67108910])
 (jedi:key-goto-definition-pop-marker .
				      [67108908])
 (jedi:key-related-names . "�r")
 (jedi:key-show-doc . "�d")
 (jedi:server-args)
 (jedi:server-command "c:/Users/xxxxxx/.emacs.d/.python-environments/default/Scripts/jediepcserver.exe")
 (jedi:setup-keys . t)
 (jedi:tooltip-method pos-tip popup)
 (jedi:use-shortcuts)
 (python-environment-default-root-name . "default")
 (python-environment-directory . "~/.emacs.d/.python-environments")
 (python-environment-virtualenv "python" "-m" "venv"))

@glyph
Copy link
Contributor

glyph commented Jan 29, 2019

I have the same issue.

For me, this typically starts (in *epc:server*) - ERROR:epc:AttributeError("'FStringStart' object has no attribute 'children'",).

Hopefully that's a hint!

@immerrr
Copy link
Collaborator

immerrr commented Jan 29, 2019

I'll try to reproduce it locally right now, but would be very nice if someone could provide some repro steps.

@immerrr
Copy link
Collaborator

immerrr commented Jan 29, 2019

FStringStart thing is related to parso: https://github.com/davidhalter/parso/search?q=FStringStart&unscoped_q=FStringStart

and could be related to the recent update in Jedi: davidhalter/jedi#1063 (comment) that mentioned a parso upgrade.

Did any of you upgrade jedi, emacs-jedi or parso recently?

@Muldfox
Copy link
Author

Muldfox commented Jan 29, 2019

Did any of you upgrade jedi, emacs-jedi or parso recently?

I haven't upgraded anything individually. I just installed whatever is in my init.el file through MELPA, as well as the modules that "jedi:install-server" will automatically add to the python environment. But what turned out solving it for me, was to downgrade to Jedi 0.11.0 in the python environment that Jedi is using (~/.emacs.d/.python-environment/default).

Here is my init.el file.

This is how I did it, unnecessary steps and all:
(I'm using Windows 10 Pro, Emacs 26.1, Python 3.6.7)

  1. Using my init.el will install everything needed through MELPA.
  2. Start Emacs, let packages and everything setup.
  3. Restart Emacs.
  4. Find and open Python file.
  5. M-x jedi:install-server
  6. M-x jedi:start-dedicated-server
  7. Restart Emacs
  8. Go to Python file and experience the assertion error bug. Completion will work on the top lines of my ~200 lines long file. Like, completion suggestions/menu will appear around line 50. But at around line 180, I will get no suggestions what so ever.

I tried re-installing the Jedi server multiple times to no avail.

Again, what solved it for me was to uninstall the current Jedi python module (0.13.2) and install Jedi version 0.11.0 instead (inside of the default python environment "~/.emacs.d/.python-environments/default").

And boom, the Jedi completion works flawlessly! No matter how big the file is. It's been working without any issues whatsoever the entire day after I downgraded the Jedi python module inside of the environment.

@glyph
Copy link
Contributor

glyph commented Jan 29, 2019

Yes. I have a script that reinstalls all my packages that I run once a week or so, so I've upgraded everything a couple of days ago.

$ ~/.emacs.d/.python-environments/default/bin/pip freeze
epc==0.0.5
jedi==0.13.2
jediepcserver==0.2.7
parso==0.3.2
sexpdata==0.0.3
tzlocal==1.5.1

I'll try doing a ~/.emacs.d/.python-environments/default/bin/pip install 'parso!=0.3.2' to see if that fixes it.

@Muldfox
Copy link
Author

Muldfox commented Jan 29, 2019

λ .emacs.d\.python-environments\default\Scripts\activate.bat

λ (default) pip freeze
epc==0.0.5
jedi==0.11.0
jediepcserver==0.2.7
parso==0.1.0
sexpdata==0.0.3

Jedi works fine for me now, and these are the packages in use.

@immerrr
Copy link
Collaborator

immerrr commented Jan 30, 2019

If downgrading helps, the problem is clearly with the new version of jedi/parso. But I still have hard time reproducing it.

Could you try adding

(setq jedi:server-args `("--log-level=DEBUG"
                         ,(format "--log=%s" (expand-file-name "~/jediepcserver.log"))
                         "--log-traceback"))

to the config and check the $HOME/jediepcserver.log.* files for clues regarding what's happening?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants