Closed MooersLab closed 2 years ago
Thanks for the report. I think I fixed it. Can you try the latest version?
Thank you for the fast reply!
After I created a conda env and installed several dependent packages, the script ran without error. However, the images are not showing up in the kitty terminal. The binary code for the png file is inside the output script file, but the image in not being rendered. Which extension(s) did you add to kitty to get the images to appear?
pip install .
in the saturn folder? That should install all the dependencies.saturn version
, so we know what it's using?kitty +kitten icat ~/images/5uuuU9C24.png
also works.saturn 1.0.5
wurlitzer 3.0.2
rich 12.3.0
ptpython 3.0.20
dill 0.3.4
markdown 3.3.6
atomicwrites 1.4.0
pygments 2.12.0
more_itertools 8.12.0
matplotlib 3.5.1
I am using a Mac OS 10.15.7 (Catalina).
I can report that saturn works as you advertised on Ubuntu TLS 20.04. That is, the simple.py file displays an image in a kitty terminal. I had python3.8 installed. I had to install Python3.9 to be able to run saturn.
The option to redirect the notebook to a PDF would be useful for sharing static notebooks with people who lack kitty. Exporting to html and then converting to PDF via pandoc is a route.
However, the --html option in the README.md file is not in the on-line help. The usage of the --html flag needs an example. The position of this flag in a command is unclear.
What version of kitty are you using? Your macOS is older than mine, but I don't see why that should matter. In general, can you give me any more information about this not working with kitty on mac? I cannot guess at the moment what the problem could be.
Python 3.8 vs 3.9 is my mistake (I added this requirement when fixing this issue), but it's an overkill. I can bump it down in the next version.
I pushed an example of --html
to the README. PDF is a nice goal, but it would require quite a bit of work. Going through html is the easiest route right now.
I am using kitty 0.25.0.
From my home directory in a kitty terminal:
saturn show ./software/saturn/samples/simple.py --html notebook.html
open notebook.html
Looks great! Thank you for the example.
This is most mysterious. Does it fail to display the images when you do saturn run ...
or saturn show ...
, or both?
Fails to display with both
saturn show ./software/saturn/samples/simple.py
saturn clean ./software/saturn/samples/simple.py
saturn run ./software/saturn/samples/simple.py
What does echo $TERM
say?
xterm-24bit
Ah! Then mystery solved. saturn
expects $TERM
to be xterm-kitty
, when running under Kitty. That's how it determines whether to turn on image output.
Now the question is why doesn't yours say xterm-kitty
, and how common is this problem?
Meanwhile, you can try export TERM=xterm-kitty
and see if it starts working.
Thank you very much!!!
Yes, mystery solved! It worked after I entered export TERM=xterm-kitty
.
I had called from iterm the kitty binary in /Applications via an alias:
alias kitty=/Applications/kitty.app/Contents/MacOS/kitty
The alias shouldn't make a difference. I need to find a better way to detect whether we are running under Kitty. I'll investigate what that is.
Some post-closure comments for future readers:
The following pandoc command makes the html to pdf conversion.
pandoc -f html -t pdf -o notebook.pdf notebook.html
The conversion to docx also works.
pandoc -f html -t docx -o notebook.docx notebook.html
The conversion to latex fails to add the figure environment.
pandoc -f html -t latex -o notebook.tex notebook.html
You can convert your script to a beamer latex file to make a slideshow. You will have to add figure environments to import images and a preamble with your preferred configuration, but it may save time when preparing a group meeting presentation.
pandoc -f html -t beamer -o notebookbeamer.tex notebook.html
If the Python script can be converted to GitHub markdown with code blocks, pandoc could convert the md documents in a ipynb (Juptyer notebook) document.
In leiu of the markdown version, the program p2j converts a python script to a Jupyter notebook. The conversion is not perfect, but it works well enough and saves time. The code blocks run. Install via pip install p2j
.
Then you can convert the Jupyter notebook to a reveal.js slideshow inside Jupyter.
Thanks for the debrief. I'm going to look for better ways to detect kitty/graphics protocol, but meanwhile I'll close this issue.
Interesting project!!
I installed rich via pip.
I git cloned the project and ran the following code in a kitty terminal.