Name of the running.jl or notebook()


#1

Hi,
I’m facing something that apparently does not seem very simple to solve. The fact is that I’m producing some code that can either go on a notebook() in IJupyter, or be pasted on an ASCII text file (with .jl extension), and be run on the REPL. The fact is that I would like to know if there is a simple way to get the name of the file being ran.
For exemple ‘croco.jl’ (REPL) or ‘dile.ipynb’ (notebook) from within the code…
Thanks a lot,
Ferran.


#2
@__FILE__

works for .jl file. Not sure what it does for notebooks.


#3

Thanks for the info, I already tried that. However, n the notebook it simply says “”


#4

It’s not so easy to get this information in the notebook — it’s not directly available to the IJulia kernel in the Jupyter protocol. See e.g.