# Buggy code
def main(args, error):
    """
    Makes sure that the assets have been converted,
    and jumps into the C++ main method.
    """
    del error  # unused

    # we have to import stuff inside the function
    # as it depends on generated/compiled code
    from .main_cpp import run_game
    from .. import config
    from ..assets import get_asset_path
    from ..convert.main import conversion_required, convert_assets
    from ..cppinterface.setup import setup as cpp_interface_setup
    from ..cvar.location import get_config_path
    from ..util.fslike.union import Union

    # initialize libopenage
    cpp_interface_setup(args)

    info("launching openage %s", config.VERSION)
    info("compiled by %s", config.COMPILER)

    if config.DEVMODE:
        info("running in DEVMODE")

    # create virtual file system for data paths
    root = Union().root

    # mount the assets folder union at "assets/"
    root["assets"].mount(get_asset_path(args.asset_dir))

    # mount the config folder at "cfg/"
    root["cfg"].mount(get_config_path(args.cfg_dir))

    # ensure that the assets have been converted
    if wanna_convert() or conversion_required(root["assets"], args):
        # try to get previously used source dir
        asset_location_path = root["cfg"] / "asset_location"
        try:
            with asset_location_path.open("r") as file_obj:
                prev_source_dir_path = file_obj.read().strip()
        except FileNotFoundError:
            prev_source_dir_path = None
        used_asset_path = convert_assets(
            root["assets"], root["cfg"], args, prev_source_dir_path=prev_source_dir_path
        )
        if used_asset_path:
            # Remember the asset location
            with asset_location_path.open("wb") as file_obj:
                file_obj.write(used_asset_path)
        else:
            err("game asset conversion failed")
            return 1

    # start the game, continue in main_cpp.pyx!
    return run_game(args, root)


# Traceback (AttributeError)
INFO [py] launching openage v0.4.1-371-g0c6e704b
INFO [py] compiled by GNU 10.2.0
Do you want to convert assets? [Y/n]
y
Traceback (most recent call last):
File "/app/bin/openage", line 15, in <module>
main()
File "/app/lib/python3.8/site-packages/openage/__main__.py", line 132, in main
return args.entrypoint(args, cli.error)
File "/app/lib/python3.8/site-packages/openage/game/main.py", line 68, in main
used_asset_path = convert_assets(root["assets"], root["cfg"], args,
File "/app/lib/python3.8/site-packages/openage/convert/main.py", line 52, in convert_assets
debug_cli_args(args.debugdir, args.debug_info, args)
AttributeError: 'UnionPath' object has no attribute 'debug_info'

# Fixed code
def main(args, error):
    """
    Makes sure that the assets have been converted,
    and jumps into the C++ main method.
    """
    del error  # unused

    # we have to import stuff inside the function
    # as it depends on generated/compiled code
    from .main_cpp import run_game
    from .. import config
    from ..assets import get_asset_path
    from ..convert.main import conversion_required, convert_assets
    from ..cppinterface.setup import setup as cpp_interface_setup
    from ..cvar.location import get_config_path
    from ..util.fslike.union import Union

    # initialize libopenage
    cpp_interface_setup(args)

    info("launching openage %s", config.VERSION)
    info("compiled by %s", config.COMPILER)

    if config.DEVMODE:
        info("running in DEVMODE")

    # create virtual file system for data paths
    root = Union().root

    # mount the assets folder union at "assets/"
    root["assets"].mount(get_asset_path(args.asset_dir))

    # mount the config folder at "cfg/"
    root["cfg"].mount(get_config_path(args.cfg_dir))
    args.cfg_dir = root["cfg"]

    # ensure that the assets have been converted
    if wanna_convert() or conversion_required(root["assets"], args):
        # try to get previously used source dir
        asset_location_path = root["cfg"] / "asset_location"
        try:
            with asset_location_path.open("r") as file_obj:
                prev_source_dir_path = file_obj.read().strip()
        except FileNotFoundError:
            prev_source_dir_path = None
        used_asset_path = convert_assets(
            root["assets"], args, prev_source_dir_path=prev_source_dir_path
        )

        if used_asset_path:
            # Remember the asset location
            with asset_location_path.open("wb") as file_obj:
                file_obj.write(used_asset_path)
        else:
            err("game asset conversion failed")
            return 1

    # Exit here with an explanation because the converted assets are incompatible!
    # Remove this when the gamestate works again
    info("Generated nyan assets are not yet compatible to the engine.")
    info(
        "Please revert to release v0.4.1 if you want to test the previous working gamestate."
    )
    info("Exiting...")
    import sys

    sys.exit()

    # start the game, continue in main_cpp.pyx!
    return run_game(args, root)