Skip to content

quarto execution errors are not propagated #89

@enryH

Description

@enryH

Somehow using subprocess.run execution errors from quarto are not passed from the subprocess. The blow execution will not generate an html file, but still say that the execution was successful through vuegen. I added at the end the return code from the subprocess.

[2025-03-10 10:58:11,127] root: INFO - Created qmd script to render the app: quarto_report.qmd
[2025-03-10 10:58:11,127] root: INFO - Running 'Basic Example Vuegen Demo Notebook' 'HTML' report with ['quarto', 'render', '/Users/test/vuegen_gen/reports/quarto_report/quarto_report.qmd']

Executing 'quarto_report.quarto_ipynb'
  Cell 1/11: 'Imports'....................................Done
  Cell 2/11: 'Top Species Plot By Biome Plotly 1'.........Done
  Cell 3/11: 'Multiline Plot Altair 2'....................ERROR: 

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

with open('/Users/test/repos/vuegen/docs/example_data/Basic_example_vuegen_demo_notebook/1_Plots/1_Interactive_plots/2_multiline_plot_altair.json', 'r') as plot_file:
    plot_json = plot_file.read()
fig_altair = alt.Chart.from_json(plot_json).properties(width=900, height=400)
fig_altair
------------------


---------------------------------------------------------------------------
ValidationError                           Traceback (most recent call last)
Cell In[12], line 3
      1 with open('/Users/test/repos/vuegen/docs/example_data/Basic_example_vuegen_demo_notebook/1_Plots/1_Interactive_plots/2_multiline_plot_altair.json', 'r') as plot_file:
      2     plot_json = plot_file.read()
----> 3 fig_altair = alt.Chart.from_json(plot_json).properties(width=900, height=400)
      4 fig_altair

File ~/miniforge3/envs/vuegen/lib/python3.9/site-packages/altair/utils/schemapi.py:452, in SchemaBase.from_json(cls, json_string, validate, **kwargs)
    435 """Instantiate the object from a valid JSON string
    436 
    437 Parameters
   (...)
    449     The altair Chart object built from the specification.
    450 """
    451 dct = json.loads(json_string, **kwargs)
--> 452 return cls.from_dict(dct, validate=validate)

File ~/miniforge3/envs/vuegen/lib/python3.9/site-packages/altair/vegalite/v4/api.py:2009, in Chart.from_dict(cls, dct, validate)
   2006         pass
   2008 # As a last resort, try using the Root vegalite object
-> 2009 return core.Root.from_dict(dct, validate)

File ~/miniforge3/envs/vuegen/lib/python3.9/site-packages/altair/utils/schemapi.py:427, in SchemaBase.from_dict(cls, dct, validate, _wrapper_classes)
    403 """Construct class from a dictionary representation
    404 
    405 Parameters
   (...)
    424     if validate=True and dct does not conform to the schema
    425 """
    426 if validate:
--> 427     cls.validate(dct)
    428 if _wrapper_classes is None:
    429     _wrapper_classes = cls._default_wrapper_classes()

File ~/miniforge3/envs/vuegen/lib/python3.9/site-packages/altair/utils/schemapi.py:463, in SchemaBase.validate(cls, instance, schema)
    461     schema = cls._schema
    462 resolver = jsonschema.RefResolver.from_schema(cls._rootschema or cls._schema)
--> 463 return validate_jsonschema(instance, schema, resolver=resolver)

File ~/miniforge3/envs/vuegen/lib/python3.9/site-packages/altair/utils/schemapi.py:59, in validate_jsonschema(spec, schema, resolver)
     57 error = jsonschema.exceptions.best_match(validator.iter_errors(spec))
     58 if error is not None:
---> 59     raise error

ValidationError: {'param': 'param_57', 'value': 1, 'empty': False} is not valid under any of the given schemas

Failed validating 'anyOf' in schema[0]['properties']['encoding']['properties']['opacity']['properties']['condition']:
    {'anyOf': [{'anyOf': [{'$ref': '#/definitions/ConditionalValueDef<(number|ExprRef)>'},
                          {'items': {'$ref': '#/definitions/ConditionalValueDef<(number|ExprRef)>'},
                           'type': 'array'}],
                'description': 'One or more value definition(s) with [a '
                               'selection or a test '
                               'predicate](https://vega.github.io/vega-lite/docs/condition.html).\n'
                               '\n'
                               "__Note:__ A field definition's `condition` "
                               'property can only contain [conditional '
                               'value '
                               'definitions](https://vega.github.io/vega-lite/docs/condition.html#value) '
                               'since Vega-Lite only allows at most one '
                               'encoded field per encoding channel.'},
               {'anyOf': [{'$ref': '#/definitions/ConditionalMarkPropFieldOrDatumDef'},
                          {'$ref': '#/definitions/ConditionalValueDef<(number|ExprRef)>'},
                          {'items': {'$ref': '#/definitions/ConditionalValueDef<(number|ExprRef)>'},
                           'type': 'array'}],
                'description': 'A field definition or one or more value '
                               'definition(s) with a selection '
                               'predicate.'}],
     'description': 'One or more value definition(s) with [a selection or '
                    'a test '
                    'predicate](https://vega.github.io/vega-lite/docs/condition.html).\n'
                    '\n'
                    "__Note:__ A field definition's `condition` property "
                    'can only contain [conditional value '
                    'definitions](https://vega.github.io/vega-lite/docs/condition.html#value) '
                    'since Vega-Lite only allows at most one encoded field '
                    'per encoding channel.'}

On instance['encoding']['opacity']['condition']:
    {'param': 'param_57', 'value': 1, 'empty': False}

[2025-03-10 10:58:12,059] root: DEBUG - Quarto report rendered subprocess return: CompletedProcess(args=['quarto', 'render', '/Users/test/vuegen_gen/reports/quarto_report/quarto_report.qmd'], returncode=0)
[2025-03-10 10:58:12,059] root: DEBUG - Quarto report rendered subprocess return code: 0
[2025-03-10 10:58:12,059] root: INFO - 'Basic Example Vuegen Demo Notebook' 'HTML' report rendered

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions