-
Notifications
You must be signed in to change notification settings - Fork 58
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
Asserts fail with no message #324
Comments
It seems that this was used for static type checking, meaning that it should never happen at runtime either. Could you share how you use nbclient? |
Yes, I'm building a wrapper for nbclient to make available some of the notebook functions to an LLM agent. More specifically, I'm making a few high level functions like Here's a bit of pseudocode showing what the workflow looks like: notebook = nbformat.reads(notebook_content, as_version=4)
client = NotebookClient(notebook)
index=0
for cell in notebook.cells:
if cell.id == id:
result = client.execute_cell(cell, index)
else:
index += 1 |
That code likely won't run nicely fwiw, it's sort of ripped out of the stuff I'm building now, and it's possible that code does actually run and initialization of a NotebookClient without a kernel or kernel manager isn't an issue normally and my langchain code is getting in the way. |
Here is a better MWE:
Which gives unexpected error:
|
Odd to me is that I can actually execute the whole notebook it appears, so maybe I am misusing the cell execution api? This code seems to work (and at the least does not throw the assertion error):
|
Just an update for those who might be running into a similar problem or are trying to use the nbclient package in a similar way, this is how I create and init a new
|
I was trying to programmatically interact with the nbclient package and kept getting blank assertion errors being thrown. It was a bit of a mess on my end to track down since nbclient was being hidden behind numerous other libraries I was working with, here's one of the ones which would regularly throw, indicating that there is no kernel available:
nbclient/nbclient/client.py
Line 960 in 2650b21
Any reason to use asserts here instead of something more friendly to calling libraries, e.g. a new KernelNotConfiguredException?
The text was updated successfully, but these errors were encountered: