Get help from the marimo community

Updated yesterday

mo.pdf doesn't work with local file names/paths? Seems to work with URLs as `src` argument

H
m
M
9 comments
Error message stated:
"So I think I found a bug with mo.pdf . I can't seem to get mo.pdf to open a local pdf. It works with the src as a url, but not from a file."
The issue is you would need to have the mo.pdf(src=pdf_file) assigned to a variable which you state at the end of the cell block for it to be rendered as the output.
This is the case with conditional statements in general. For example:

Plain Text
actual = None
with open("2104.00282v4.pdf", "rb") as file:
    actual = mo.pdf(src=file)
actual
You can see the working solution for your issue here: https://marimo.app/l/6qpvve
Just upload the PDF from the top left "View Files" explorer section and the above notebook should work.
Ok, yeah that makes sense. The documentation example is a bit misleading since it doesn't assign Mo.pdf to a variable that can be placed at the end of the cell.

The with open block doesn't return anything, the documentation should probably be updated to reflect that
Ah, thanks for that.
We can use Path to avoid the with block
yeah, I guess I should have said I found a bug in the documentation. but, did learn with blocks return nothing (null?)...
Add a reply
Sign up and join the conversation on Discord