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

Fix ValueError from repeated import ehtplot.color #6

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

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