Skip to content

Conversation

@endolith
Copy link

@endolith endolith commented Aug 7, 2024

If a script importing this module is run more than once, it produces

ValueError: A colormap named "afmhot_10u" is already registered.

Now it overwrites the existing colormaps instead, and fixes #5.

If a script importing this module is run more than once, it produces

    ValueError: A colormap named "afmhot_10u" is already registered.

Now it overwrites the existing colormaps instead, and fixes liamedeiros#5.
@endolith
Copy link
Author

endolith commented Aug 7, 2024

Actually this seemed to work fine when I tested it, but now that I'm actually using it to produces a raft of warnings:

… 
…\core.py:45: UserWarning: Overwriting the cmap 'YlOrRd_ur' that was already in the registry.
  register_cmap(name=name + ("_r" if unmodified(name) else "r"),
…\core.py:42: UserWarning: Overwriting the cmap 'YlOrRd_us' that was already in the registry.
  register_cmap(name=name, cmap=cmap, override_builtin=True)
…\core.py:45: UserWarning: Overwriting the cmap 'YlOrRd_usr' that was already in the registry.
  register_cmap(name=name + ("_r" if unmodified(name) else "r"),

So maybe that's not the best approach.

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.

Importing more than once raises ValueError

1 participant