Skip to content

relative imports fail for some output folders #135

@enryH

Description

@enryH
>>> vuegen -dir docs/example_data/Basic_example_vuegen_demo_notebook -output_dir tests/report_examples/Basic_example_vuegen_demo_notebook -rt html
...

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

with open('../docs/example_data/Basic_example_vuegen_demo_notebook/1_Plots/1_Interactive_plots/1_top_species_plot_by_biome_plotly.json', 'r') as plot_file:
    plot_json = json.load(plot_file)

# Keep only 'data' and 'layout' sections
plot_json = {key: plot_json[key] for key in plot_json if key in ['data', 'layout']}

# Remove 'frame' section in 'data'
plot_json['data'] = [{k: v for k, v in entry.items() if k != 'frame'} for entry in plot_json.get('data', [])]

# Convert JSON to string
plot_json_str = json.dumps(plot_json)

# Create the plotly plot
fig_plotly = pio.from_json(plot_json_str)
fig_plotly.update_layout(autosize=False, width=950, height=400, margin=dict(b=50, t=50, l=50, r=50))

fig_plotly.show()
------------------


---------------------------------------------------------------------------
FileNotFoundError                         Traceback (most recent call last)
Cell In[2], line 1
----> 1 with open('../docs/example_data/Basic_example_vuegen_demo_notebook/1_Plots/1_Interactive_plots/1_top_species_plot_by_biome_plotly.json', 'r') as plot_file:
      2     plot_json = json.load(plot_file)
      4 # Keep only 'data' and 'layout' sections

File ~/miniforge3/envs/vuegen_py312/lib/python3.12/site-packages/IPython/core/interactiveshell.py:325, in _modified_open(file, *args, **kwargs)
    318 if file in {0, 1, 2}:
    319     raise ValueError(
    320         f"IPython won't let you open fd={file} by default "
    321         "as it is likely to crash IPython. If you know what you are doing, "
    322         "you can use builtins' open."
    323     )
--> 325 return io_open(file, *args, **kwargs)

FileNotFoundError: [Errno 2] No such file or directory: '../docs/example_data/Basic_example_vuegen_demo_notebook/1_Plots/1_Interactive_plots/1_top_species_plot_by_biome_plotly.json'

Traceback (most recent call last):
  File "/Users/heweb/miniforge3/envs/vuegen_py312/bin/vuegen", line 8, in <module>
    sys.exit(main())
             ^^^^^^
  File "/Users/heweb/Documents/repos/vuegen/src/vuegen/__main__.py", line 42, in main
    _, _ = report_generator.get_report(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/heweb/Documents/repos/vuegen/src/vuegen/report_generator.py", line 130, in get_report
    quarto_report.run_report(output_dir=report_dir)
  File "/Users/heweb/Documents/repos/vuegen/src/vuegen/quarto_reportview.py", line 289, in run_report
    raise FileNotFoundError(f"Report file could not be created: {out_path}")
FileNotFoundError: Report file could not be created: tests/report_examples/Basic_example_vuegen_demo_notebook/quarto_report/quarto_report.html

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions