Skip to content
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

[Q&A]: setup 'cell' behaviour in book project #17

Open
lmoresi opened this issue Apr 11, 2024 · 1 comment
Open

[Q&A]: setup 'cell' behaviour in book project #17

lmoresi opened this issue Apr 11, 2024 · 1 comment
Labels
s: question-answered t: question Further information is requested

Comments

@lmoresi
Copy link

lmoresi commented Apr 11, 2024

What's your question?

Great plugin / extension. Really great start at making code snippets work for web documents. Installation of the current version of the extension

My question is related to the setup cell/s that I would like to use to install some files in the local filesystem so students can practice reading and writing simple files in python (before they get to more complicated packages to do this for them).

The simplest example is below. I define a variable in a setup cell, and try to reference it later.

If I change the first cell to run interactively, it works, of course. I am not sure how to debug (how to see if code in the setup is run but in the wrong namespace ?) or if this is simply not yet fully implemented. Is this my issue or should I raise this as a bug ?

---
title: Test Pyodide plugin
author: 
    - Louis Moresi
---

```{pyodide-python}
#| context: setup
x = 1
```

```{pyodide-python}
#| context: interactive
print(x)
```

Output of cell 2:

PythonError: Traceback (most recent call last):
  File "/lib/python311.zip/_pyodide/_base.py", line 573, in eval_code_async
    await CodeRunner(
  File "/lib/python311.zip/_pyodide/_base.py", line 393, in run_async
    coroutine = eval(self.code, globals, locals)
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "", line 1, in 
NameError: name 'x' is not defined
@lmoresi lmoresi added s: question-needs-answer Question has yet to be answered. t: question Further information is requested labels Apr 11, 2024
@coatless
Copy link
Collaborator

@lmoresi thanks for the question! At the moment, only support for the interactive context is active.

Unfortunately, not all options from quarto-webr are available. We hope to have the non-interactive cells activated shortly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
s: question-answered t: question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants