We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 33afe63 commit a64cb3fCopy full SHA for a64cb3f
py/_path/common.py
@@ -10,6 +10,12 @@
10
# Moved from local.py.
11
iswin32 = sys.platform == "win32" or (getattr(os, '_name', False) == 'nt')
12
13
+try:
14
+ # FileNotFoundError might happen in py34, and is not available with py27.
15
+ import_errors = (ImportError, FileNotFoundError)
16
+except NameError:
17
+ import_errors = (ImportError,)
18
+
19
try:
20
from os import fspath
21
except ImportError:
@@ -35,9 +41,7 @@ def fspath(path):
35
41
raise
36
42
37
43
import pathlib
38
- except ImportError:
39
- pass
40
- except FileNotFoundError: # Might happen in py34.
44
+ except import_errors:
45
pass
46
else:
47
if isinstance(path, pathlib.PurePath):
0 commit comments