Open
Description
I have code tested in Python 3 (3.5.2) that uses FileExistsError
and have used pasteurize
to attempt Py2/3 support. When I attempt to run the code under a Python 2.6.6 environment (installed importlib, unittest2, argparse beforehand), it encounters a NameError because of undefined FileExistsError
:
Traceback (most recent call last):
File "/home/dspruell/devel/project/env/bin/project-cmd", line 11, in <module>
load_entry_point('project==0.2.4', 'console_scripts', 'project-cmd')()
File "/home/dspruell/devel/project/env/lib/python2.6/site-packages/project/cli.py", line 86, in main
except FileExistsError as e:
NameError: global name 'FileExistsError' is not defined
Following are the use in modules:
try:
args.func(args)
except FileExistsError as e:
parser.error('Refusing to clobber existing path ({err})'.format(err=e))
try:
os.makedirs(configdir)
except FileExistsError as e:
if not args.force:
raise
For what it's worth, under Python 2.6 the exception that's raised in place of FileExistsError is OSError.
Is this something one should expect python-future to handle?