Skip to content

FileNotFoundError when running Zehef outside the project directory (missing config.json path resolution) #29

@ShutdownRepo

Description

@ShutdownRepo

When running Zehef from outside its directory (e.g., using an absolute path), the program crashes because it cannot locate config.json.
The path to the config file appears to be resolved relative to the current working directory rather than the script’s location.

Tool was installed in a venv and is called with the following command : /opt/tools/Zehef/venv/bin/python3 /opt/tools/Zehef/zehef.py -h

Traceback (most recent call last):
  File "/opt/tools/Zehef/zehef.py", line 5, in <module>
    from main import main; asyncio.run(main())
                           ^^^^^^^^^^^^^^^^^^^
  File "/root/.pyenv/versions/3.11.13/lib/python3.11/asyncio/runners.py", line 190, in run
    return runner.run(main)
           ^^^^^^^^^^^^^^^^
  File "/root/.pyenv/versions/3.11.13/lib/python3.11/asyncio/runners.py", line 118, in run
    return self._loop.run_until_complete(task)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/root/.pyenv/versions/3.11.13/lib/python3.11/asyncio/base_events.py", line 654, in run_until_complete
    return future.result()
           ^^^^^^^^^^^^^^^
  File "/opt/tools/Zehef/main.py", line 10, in main
    await parser()
  File "/opt/tools/Zehef/lib/cli.py", line 10, in parser
    await Version_Checker.checker()
  File "/opt/tools/Zehef/lib/update.py", line 7, in checker
    with open('config.json', "+r", encoding='utf-8') as file:
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
FileNotFoundError: [Errno 2] No such file or directory: 'config.json'

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions