C
C#2y ago
teauxfu

❔ ✅ Is there a way to execute a .NET Interactive notebook from the command line?

I found this related Stack Overflow post, which comes pretty close to what I want. However I'm expecting rather to run something like dotnet-interactive run "path/to/my/notebook.dib" https://stackoverflow.com/questions/67801621/can-i-run-net-interactive-ipynb-from-command-line
Stack Overflow
Can I run .NET Interactive (.ipynb) from Command Line?
I have a .NET Interactive Notebook, works fine when I execute from VS Code with the extension This contains a sequence of PowerShell scripts, that I use for local builds on my system I want to re-u...
8 Replies
teauxfu
teauxfuOP2y ago
Description:
Interactive programming for .NET.

Usage:
dotnet-interactive [command] [options]

Options:
--log-path <log-path> Enable file logging to the specified directory
--verbose Enable verbose logging to the console
--version Show version information
-?, -h, --help Show help and usage information

Commands:
jupyter <connection-file> Starts dotnet-interactive as a Jupyter kernel
stdio Starts dotnet-interactive with kernel functionality exposed over standard I/O
notebook-parser Starts a process to parse and serialize notebooks.
Description:
Interactive programming for .NET.

Usage:
dotnet-interactive [command] [options]

Options:
--log-path <log-path> Enable file logging to the specified directory
--verbose Enable verbose logging to the console
--version Show version information
-?, -h, --help Show help and usage information

Commands:
jupyter <connection-file> Starts dotnet-interactive as a Jupyter kernel
stdio Starts dotnet-interactive with kernel functionality exposed over standard I/O
notebook-parser Starts a process to parse and serialize notebooks.
I can run dotnet-interactive jupyter notebook.dib but I get smacked with a huge ugly exception
Unhandled exception: System.Text.Json.JsonException: '#' is an invalid start of a value. Path: $ | LineNumber: 0 | BytePositionInLine: 0.
---> System.Text.Json.JsonReaderException: '#' is an invalid start of a value. LineNumber: 0 | BytePositionInLine: 0.
at System.Text.Json.ThrowHelper.ThrowJsonReaderException(Utf8JsonReader& json, ExceptionResource resource, Byte nextByte, ReadOnlySpan`1 bytes)
...
Unhandled exception: System.Text.Json.JsonException: '#' is an invalid start of a value. Path: $ | LineNumber: 0 | BytePositionInLine: 0.
---> System.Text.Json.JsonReaderException: '#' is an invalid start of a value. LineNumber: 0 | BytePositionInLine: 0.
at System.Text.Json.ThrowHelper.ThrowJsonReaderException(Utf8JsonReader& json, ExceptionResource resource, Byte nextByte, ReadOnlySpan`1 bytes)
...
teauxfu
teauxfuOP2y ago
Alas, this may just not be possible https://github.com/dotnet/interactive/issues/839
GitHub
.NET Interactive Notebooks should have a programmatic way of execut...
Is your feature request related to a problem? Please describe. .NET Interactive Notebooks should have a programmatic way of executing them. Describe the solution you'd like When executing .NET ...
teauxfu
teauxfuOP2y ago
I was able to work around this by converting the notebook to .ipynb and executing it via papermill https://papermill.readthedocs.io/en/latest/usage-execute.html !close
Accord
Accord2y ago
Closed!
teauxfu
teauxfuOP2y ago
Stack Overflow
Can I run .NET Interactive (.ipynb) from Command Line?
I have a .NET Interactive Notebook, works fine when I execute from VS Code with the extension This contains a sequence of PowerShell scripts, that I use for local builds on my system I want to re-u...
Accord
Accord2y ago
Was this issue resolved? If so, run /close - otherwise I will mark this as stale and this post will be archived until there is new activity.
jonsequitur
jonsequitur2y ago
I commented on the StackOverflow issue but repeating it here. You can use dotnet-repl: https://github.com/jonsequitur/dotnet-repl.
Accord
Accord2y ago
Was this issue resolved? If so, run /close - otherwise I will mark this as stale and this post will be archived until there is new activity.
Want results from more Discord servers?
Add your server