jupyterlab-contrib / jupyterlab_code_formatter

A JupyterLab plugin to facilitate invocation of code formatters.
https://jupyterlab-code-formatter.readthedocs.io/
MIT License
853 stars 55 forks source link

error: Cannot parse: 1:10: isinstance? #148

Closed michaelaye closed 4 years ago

michaelaye commented 4 years ago

Checklist prior to opening an issue

Describe the bug

Notebook throws error when trying to format:

Cannot parse: 1:10: isinstance?

Diagnostic commands Please attach the output of the following commands (please format them properly)

Screenshots

Screenshot 2020-06-02 16 52 05
ryantam626 commented 4 years ago

Could you copy and paste content of the cell where you defined find_best_header please :pray: ? I need that for reproducing the error

ryantam626 commented 4 years ago

I am pretty sure it's due to invalid Python in the cell, re-open this issue if it's not :)

michaelaye commented 4 years ago

sorry for the lack of reply. you are seeing everything, and the function works. What does the 1:10 in the error mean? I cannot deduce what it points to...

ryantam626 commented 4 years ago

It means there is a syntax error in your code, line 1 column 10. Actually I see the issue now, you need to comment out the isinstance? cell

michaelaye commented 4 years ago

ah, all lines of code together, makes sense now, thanks. Ok, so it needs to be Python legal, not IPython legal, understood.

ryantam626 commented 4 years ago

Yep that's exactly it! :+1:

michaelaye commented 4 years ago

doh, it actually says so in the error! I thought instance referred to some instance of an object in your code but it actually cites the broken line! DOH!

michaelaye commented 4 years ago

great extension btw, i love it!

ryantam626 commented 4 years ago

heh, thanks for the kind words :smile: