Skip to content

Commit

Permalink
fix(Python 2): use a few aliases for exceptions
Browse files Browse the repository at this point in the history
* FileNotFoundError = IOError
* ModuleNotFoundError = ImportError
  • Loading branch information
mwtoews committed Oct 11, 2019
1 parent 7dc1ec8 commit 97d22fe
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 1 deletion.
4 changes: 4 additions & 0 deletions autotest/t011_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,14 @@
"""

import os
import sys
import flopy
import numpy as np
from nose.tools import raises

if sys.version_info[0] == 2:
FileNotFoundError = IOError


def test_mflistfile():
pth = os.path.join('..', 'examples', 'data', 'freyberg')
Expand Down
5 changes: 4 additions & 1 deletion flopy/utils/gridintersect.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
import numpy as np
import sys
if sys.version_info[0] == 2:
ModuleNotFoundError = ImportError
from .geometry import transform
try:
from shapely.geometry import MultiPoint, Point, Polygon, box
from shapely.strtree import STRtree
from shapely.affinity import translate, rotate
except ModuleNotFoundError:
print("Shapely is needed for grid intersect operations!"
print("Shapely is needed for grid intersect operations! "
"Please install shapely.")


Expand Down
3 changes: 3 additions & 0 deletions flopy/utils/mflistfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@

from ..utils.utils_def import totim_to_datetime

if sys.version_info[0] == 2:
FileNotFoundError = IOError


class ListBudget(object):
"""
Expand Down

0 comments on commit 97d22fe

Please sign in to comment.