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

Correct "libcarla.command" namespace and allow from carla.command import ... #8161

Open
wants to merge 4 commits into
base: dev
Choose a base branch
from

Conversation

Daraan
Copy link
Contributor

@Daraan Daraan commented Sep 18, 2024

Fixes #6414

Currently import carla.command or from carla.command import ... is not possible.

This will raise:

# command.py
      7 # pylint: disable=W0401
----> 8 from .libcarla.command import *

ModuleNotFoundError: No module named 'carla.libcarla.command'

This is because the command module is registered as libcarla.command in sys.modules. This is not really correct.


This PR adjusts this:

  • renames the module to carla.libcarla.command
  • provides a duplicate carla.command that can be imported.

Note / Up to discussion:
This PR deletes command.py as otherwise carla.command is not carla.libcarla.command. Both modules would be equivalent but not the same. I think this is the cleaner option.

Alternatives

This PR:

  • PRO: Compatibility is granted and extended to be more user friendly
  • CON: Duplicate module in sys.modules
  1. Instead of putting command into libcarla we could put it into carla directly without creating a duplicate carla.libcarla.command.
    • PRO: More user friendly, no duplication of the module in sys.modules.
    • CON: Not part of libcarla
  2. Do not allow import carla.command and only from carla import command
    • PRO: No duplication in sys.modules
    • CON: Less user friendly

Where has this been tested?

  • Platform(s): Ubuntu 22.04
  • Python version(s): Python 3.10
  • Unreal Engine version(s): 4.26

This change is Reviewable

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.

CARLA 0.9.14 - PythonAPI - ModuleNotFoundError: No module named 'carla.libcarla.command'
1 participant