Skip to content

wrap_viscm snippet in docs raises error #119

Description

@mfisher87

This occurs even with the plots extra installed (pip install cmocean[plots])

Traceback (most recent call last):
  File "/home/robatt/Projects/_tmp/viscm/test.py", line 3, in <module>
    cmocean.plots.wrap_viscm(cmocean.cm.haline)
    ^^^^^^^^^^^^^
AttributeError: module 'cmocean' has no attribute 'plots'

Activity

  1. mfisher87 commented on Aug 26, 2025

    @mfisher87
    Author

    This gets closer...

    import cmocean
    from cmocean.plots import wrap_viscm
    
    wrap_viscm(cmocean.cm.haline, saveplot=False)

    But now I get this error with pyside6 or pyqt6:

      File "/home/robatt/Projects/_tmp/viscm/test.py", line 4, in <module>
        wrap_viscm(cmocean.cm.haline, saveplot=False)
      File "/home/robatt/Projects/_tmp/viscm/.venv/lib/python3.11/site-packages/cmocean/plots.py", line 127, in wrap_viscm
        from viscm import viscm
      File "/home/robatt/Projects/_tmp/viscm/.venv/lib/python3.11/site-packages/viscm/__init__.py", line 5, in <module>
        from .gui import viscm, viscm_editor
      File "/home/robatt/Projects/_tmp/viscm/.venv/lib/python3.11/site-packages/viscm/gui.py", line 18, in <module>
        from matplotlib.backends.qt_compat import QtWidgets, QtCore, QtGui, _getSaveFileName
    ImportError: cannot import name '_getSaveFileName' from 'matplotlib.backends.qt_compat' (/home/robatt/Projects/_tmp/viscm/.venv/lib/python3.11/site-packages/matplotlib/backends/qt_compat.py)
    
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions