Skip to content

Debug mode fails with --background as script arg #1208

@hummat

Description

@hummat

Describe the issue

The following check for --background in sys.argv causes an error if the render script takes --background as an argument:

is_debug_mode = "--background" not in sys.argv

Error: Python: Traceback (most recent call last):
  File "<frozen importlib._bootstrap>", line 1176, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1147, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 690, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 940, in exec_module
  File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
  File "/home/matthias/.pyenv/versions/3.10.13/envs/completion/lib/python3.10/site-packages/blenderproc/__init__.py", line 39, in <module>
    SetupUtility.setup([])
  File "/home/matthias/.pyenv/versions/3.10.13/envs/completion/lib/python3.10/site-packages/blenderproc/python/utility/SetupUtility.py", line 76, in setup
    SetupUtility.setup_utility_paths(sys.argv[sys.argv.index("--") + 2])
                                              ^^^^^^^^^^^^^^^^^^^^
ValueError: '--' is not in list

Minimal code example

# Can be reproduced with the quickstart script (even though it does not actually expect a `--background` argument):

blenderproc debug blenderproc/scripts/quickstart.py --background

Files required to run the code

No response

Expected behavior

The debug mode should work but fails.

BlenderProc version

v2.8.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions