[Python] Unable to use parameters value from command line to Quarto file while rendering...

Discussão em 'Python' iniciado por Stack, Dezembro 1, 2024.

  1. Stack

    Stack Membro Participativo

    I am trying to pass parameter value using quarto CLI and use it in Quarto file with Python code but it's not working.

    Command used:

    quarto render test.qmd -P foo:5 --output test_cmd_out.html


    Quarto doc (test.qmd):

    ---
    title: "Test File"
    format: html
    html:
    embed-resources: true
    execute:
    echo: False
    jupyter: python3

    ---

    # Title


    Print this in report
    ```{python}
    foo
    ```

    ---


    Error:

    Starting python3 kernel...Done

    Executing 'test.quarto_ipynb'
    Cell 1/1: ''...ERROR:

    An error occurred while executing the following cell:
    ------------------
    foo
    ------------------


    ---------------------------------------------------------------------------
    NameError Traceback (most recent call last)
    Cell In[1], line 1
    ----> 1 foo

    NameError: name 'foo' is not defined


    Do I need to use it as params$foo even for Python or some other way?

    Not sure what is wrong if I look at their documentation.

    Continue reading...

Compartilhe esta Página