Skip to content

Matplotlib version parsing crashes import #344

@jhtu

Description

@jhtu

Describe the bug:

If MHKiT happens to be installed in an environment with a version of Matplotlib what contains non-integer characters (e.g., version 3.9.1.post1), then MHKiT will crash on import because it tries to parse the version number by splitting it apart at the decimal places, then casting each part to an int. That leads to ValueError: invalid literal for int() with base 10: 'post1' from line 14 of mhkit/wave/contours.py.

To Reproduce:

$ python3 -m venv mhkit_bug
$ source mhkit_bug/bin/activate
$ pip install mhkit matplotlib==3.9.1.post1
$ python3 -c "from mhkit import contours"

Expected behavior:

It should be possible to import MHKiT without raising a ValueError.

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions