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

fix: use cwd in module path so imports in conf.py work #27

Merged
merged 2 commits into from
Jul 2, 2024

Conversation

NickLarsenNZ
Copy link
Member

Fixes ModuleNotFoundError when trying to import other modules in conf.py:

import product1.versions as product1
import product2.versions as product2

products = [
    {
        "name": "product1",
        "versions": product1.versions,
    },
    {
        "name": "product2",
        "versions": product2.versions,
    },
]

The following error was being thrown:

Traceback (most recent call last):
  File "/home/runner/.local/bin/bake", line 8, in <module>
    sys.exit(main())
  File "/home/runner/.local/lib/python3.10/site-packages/image_tools/bake.py", line 173, in main
    conf = load_configuration(args.configuration)
  File "/home/runner/.local/lib/python3.10/site-packages/image_tools/args.py", line 195, in load_configuration
    spec.loader.exec_module(module)
  File "<frozen importlib._bootstrap_external>", line 883, in exec_module
  File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
  File "/home/runner/work/dummy-docker-images/dummy-docker-images/./conf.py", line 7, in <module>
    import product1.versions as product1
ModuleNotFoundError: No module named 'product1'

@NickLarsenNZ NickLarsenNZ self-assigned this Jul 2, 2024
@NickLarsenNZ NickLarsenNZ added this pull request to the merge queue Jul 2, 2024
Merged via the queue into main with commit 101db6f Jul 2, 2024
5 checks passed
@NickLarsenNZ NickLarsenNZ deleted the fix/module-path branch July 2, 2024 08:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants