Skip to content

Modules with dashes in their names can't be imported normally #1

@thatjpk

Description

@thatjpk

Installing django-redshift using pip install django-redshift puts a directory in site-packages named "django-redshift". To import it, one would use import django-redshift, but the dash there is a syntax error. Workarounds for this include:

  • Putting a dash-less symlink in site-packages to django-redshift allows the module to be imported using the name of the symlink.
  • Doing something like django_redshift = __import__("django-redshift") instead of a regular import statement.

Both of which are kind of gross. The pythonic solution is apparently to rename the module (see http://stackoverflow.com/questions/761519/is-it-ok-to-use-dashes-in-python-files-when-trying-to-import-them).

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