DataSpell not underlining errors - jupyter-notebook

I'm not getting error highlighting in Jupyter notebooks in DataSpell like I do in Pycharm. For example in Pycharm, BTResults would be red underlined because I didn't import it and I wouldn't need to run the cell to to see the error:
I have my settings set up to check syntax:
Do you know why not defined variables aren't getting highlighted in DataSpell?

Related

How to execute code on Jupyter Notebook when opening it

I don't know if it's possible but I would like to execute Python code inside my Jupyter notebook when opening it.
I know that I can go to Cell >> Run All, but what I am looking for is a way to automatically do it.
1) If you have nbextensions installed, you can designate "initialization cells", which run when the notebook is run. You define them using the cell -> cell type options from the menu.
2) Javascript:
from IPython.display import display, Javascript
display(Javascript("Jupyter.notebook.execute_cells_below()"))
3) For full autonomy from cells you can always import your python code, replacing
cell boundries with function calls.
In Jupyter you have to run the code cell by cell,
another shortcut is SHift+Enter to run.
If you want to run all the codes in same time you can copy it to SPyder and run.

R Studio toggle for diagnostics

I assume the R Studio toggles for diagnostics are these, found at:
Tools > Global Options > Code > Diagnostics
I have everything selected identical to the image above. If I recall properly my R Studio used to underline misspellings (red squiggly maybe) and it would put exclamation marks and warning signs when my syntax was off in the margins. For some reason this has stopped lately. I'm on R Studio Preview version 1.2.1237.
How do I toggle these diagnostics (misspellings, syntax errors, etc.) back on?
A couple of things:
RStudio currently only supports diagnostics in a document, e.g. an .R file or an R Notebook. Not in the console. Just press File -> New File -> R Script (on Mac) to create a new script file.
Furthermore, you will need to save the file (in this case, the script) at least once for code diagnostics to analyse your code. You can see that in the menu you posted: «Show diagnostics whenever source files are saved» and «Show diagnostics after keyboard is idle (...)» (the latter only works in previously saved files)
If it still doesn't get triggered, try Code -> Show Diagnostics to show the Markers tab.
Unsaved file
Saved file

Is there a way to print the live output of a cell in Jupyter Notebook to a MacBook Touch Bar?

Or even to a file or cmd prompt so I can make a script to display it myself?
I am using XGboost on a project of mine and I would like to see the validation results in the touch bar so I don't have to switch between tabs to check up on it.
The terminal results from XGBoost doesn't show the eval metrics so I can't get it from the terminal directly.

Jupyter notebook "Run All" prevents BokehJS from being successfully loaded

If I try to "Run All" cells in a Jupyter notebook, with output_notebook() in the first cell and an attempt to show a figure in a cell below, I get the following error message:
/remote/vgrnd5/davidbr/soft/miniconda3/lib/python3.5/site-packages/bokeh/io.py:350:
UserWarning:
BokehJS does not appear to have successfully loaded. If loading
BokehJS from CDN, this may be due to a slow or bad network connection.
Possible fixes:
ALWAYS run output_notebook() in a cell BY ITSELF, AT THE TOP, with no other code
re-rerun output_notebook() to attempt to load from CDN again, or
use INLINE resources instead, as so:
from bokeh.resources import INLINE
output_notebook(resources=INLINE)
warnings.warn(_NB_LOAD_WARNING)
BokehJS has been successfully loaded though (from what I see in the output of the first cell), but it looks like it has not been registered somehow, because if I run the first cell and then "Run All Bellow", then it works fine. None of the tricks of the error message work.
UPDATE: this issue has been resolved and the fix will be in 0.12.2
Evidently the behavior of the Notebook when "run all" is used is to queue up all the cell executions first, before the async outputs happen. The causes the warning to trigger spuriously. None of the core devs use "run all" with any regularity, and this specific queuing behavior was unknown. You can follow this issue for updates:
https://github.com/bokeh/bokeh/issues/4987
In particular, as an immediate workaround, there is this :

R Debugging - Cannot see which line generates warning message (Shiny)

Is there a way to make Rstudio tell you which line of which sourcefile generated a warning message?
Right now it just prints the message and I am lost as to what is causing the issue.
In Rstudio, this menu option is checked:
Debug > Error > Error Inspector
But it doesnt' help, probably because these are warnings and not errors? Ideas?
First turn on displaying warnings using the command
options(warn=1)
Then, you could run it by clicking on the "Source" or "Source with Echo" button (see image below). You can see the error/warning messages when any line with errors/warnings is executed.

Resources