quarto-ext / shinylive

Quarto extension to embed Shinylive for Python applications
https://quarto-ext.github.io/shinylive/
MIT License
141 stars 8 forks source link

Unable to render quarto doc with embedded shinylive #2

Closed ryjohnson09 closed 1 year ago

ryjohnson09 commented 1 year ago

Currently running quarto version 1.2.157, shinylive version 0.0.7.

After following the directions on https://github.com/quarto-ext/shinylive, when I try to render the quarto doc, I get the following error:

❯ quarto preview /Users/ryanjohnson/Desktop/Shiny_for_Python/Shiny4Python.qmd --to html --no-browser --no-watch-inputs
pandoc 
  to: html
  output-file: Shiny4Python.html
  standalone: true
  section-divs: true
  html-math-method: mathjax
  wrap: none
  default-image-extension: png

metadata
  document-css: false
  link-citations: true
  date-format: long
  lang: en
  title: Shiny For Python

Error: Option '--sw-dir' requires an argument.
Error running filter /Users/ryanjohnson/Desktop/Shiny_for_Python/_extensions/quarto-ext/shinylive/shinylive.lua:
Error running shinylive (error code 2): <no output>
stack traceback:
        ...or_Python/_extensions/quarto-ext/shinylive/shinylive.lua:35: in function 'getShinyliveBaseDeps'
        ...or_Python/_extensions/quarto-ext/shinylive/shinylive.lua:17: in function 'ensureShinyliveSetup'
        ...or_Python/_extensions/quarto-ext/shinylive/shinylive.lua:50: in function <...or_Python/_extensions/quarto-ext/shinylive/shinylive.lua:48>

I've tried to figure out what the --sw-dir is, but not having any luck. Let me know if you need any more information!

wch commented 1 year ago

I suspect that is happening because param("project-offset") is returning an empty string here:

https://github.com/quarto-ext/shinylive/blob/d69d4d94777d486579ad10f7cd88a726a1747a02/_extensions/quarto-ext/shinylive/shinylive.lua#L34-L39

wch commented 1 year ago

@ryjohnson09 Can you try the following:

quarto install extension quarto-ext/shinylive@debug-projectoffset
quarto render

As it renders the site, it should print out something like:

projectOffset: '.'

What does it print when you run it?

ryjohnson09 commented 1 year ago

Did the install step, and then ran quarto render and got the following output:

❯ quarto render
ERROR: The specified directory ('.') is not a Quarto project

Looks like I didn't set up a Quarto project 🤦‍♂️

quarto create-project .
quarto preview /Users/ryanjohnson/Desktop/Shiny_for_Python/Shiny4Python.qmd --to html --no-browser --no-watch-inputs

Works like a charm - thanks @wch 🎉

wch commented 1 year ago

Easy mistake to make! I'll have it print out a more helpful error message when this happens.