Skip to content

Commit

Permalink
Fix python3 compatibility bug in spack edit command (spack#6748)
Browse files Browse the repository at this point in the history
In Python 2, filter() returns a list, but in Python 3, filter()
returns an iterator, and iterators have no length.
  • Loading branch information
adamjstewart authored and scheibelp committed Dec 22, 2017
1 parent feb4f1b commit 1ce0c1b
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/spack/spack/cmd/edit.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,8 +120,8 @@ def edit(parser, args):
if not os.path.exists(path):
files = glob.glob(path + '*')
blacklist = ['.pyc', '~'] # blacklist binaries and backups
files = filter(lambda x: all(s not in x for s in blacklist),
files)
files = list(filter(
lambda x: all(s not in x for s in blacklist), files))
if len(files) > 1:
m = 'Multiple files exist with the name {0}.'.format(name)
m += ' Please specify a suffix. Files are:\n\n'
Expand Down

0 comments on commit 1ce0c1b

Please sign in to comment.