[Tutor] Any Jupyter users?
Alan Gauld
alan.gauld at yahoo.co.uk
Sun Aug 18 10:18:01 EDT 2024
I have a friend doing a CS degree and running into problems with a
Python "program" in her data science course. I said I'd take a look
although data analysis is not my forte. When I got there I was presented
with a Jupyter/Anaconda environment and the program seemed to be
effectively a long interactive session (which Jupyter can save and
rerun) about 200+ lines. Most of which is simply calling into library
functions from the anaconda stack plus a half dozen libraries installed
by pip at the top of the session.
The error (a valueError) when I got to it is raised deep inside
one of the imported libraries and the traceback does not go all
the way to the top (only 3 or 4 levels) so it's not clear where
the student's code is calling the library (although
I suspect it will be the line in Jupyter above the error
trace... But that is not calling any of the functions listed
in the traceback.
I don't use Anaconda or Jupyter so I'm not sure what debugging
facilities are available. Is there a way to generate a complete
traceback? Are there ways to find out where a function is defined
(which module?). I did a simple text search but it didn't find the
highest function listed so I assume it's inside a module somewhere,
but where? Are there any tracing facilities like the ability to step
through/into a function?
Also can you save a Jupyter session as a runnable python file
(ie with all the output stuff removed or commented out)? That way we
might get a more complete error trace from the vanilla interpreter.
Or load it into a smart IDE like Visual Code that can jump up and
down the stack.
--
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/
http://www.amazon.com/author/alan_gauld
Follow my photo-blog on Flickr at:
http://www.flickr.com/photos/alangauldphotos
More information about the Tutor
mailing list