Skip to content

Can't get Python import to work inside the import-config file #2271

Description

@wuqs-net

I'm getting the following error when trying beangulp example importers with Fava:

Error in import config '/home/qqq/beangulp/examples/import.py': Traceback (most recent call last):
  File "/home/qqq/beancount/.venv/lib/python3.12/site-packages/fava/core/ingest.py", line 331, in load_import_config
    mod = run_path(str(module_path))
          ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "<frozen runpy>", line 286, in run_path
  File "<frozen runpy>", line 98, in _run_module_code
  File "<frozen runpy>", line 88, in _run_code
  File "/home/qqq/beangulp/examples/import.py", line 3, in <module>
    from importers import acme
ModuleNotFoundError: No module named 'importers'

I've added the import-config option to the ledger file as follows:

2000-01-01 custom "fava-option" "import-config" "../import.py"

This line seems to be effective because import.py is obviously invoked by Fava, but it's having trouble finding the Python modules that are in the same directory as import.py.

What am I missing here?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions