summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdam J. Stewart <ajstewart426@gmail.com>2017-12-21 20:45:15 -0500
committerscheibelp <scheibel1@llnl.gov>2017-12-21 17:45:15 -0800
commit1ce0c1b5568228e2c273874bd4e9bf0834dbe80d (patch)
tree26f624c0ee612ad15d9a3e8c3f20731d455a54bf
parentfeb4f1b3876790c7455bb5899b48f88543a3c40f (diff)
downloadspack-1ce0c1b5568228e2c273874bd4e9bf0834dbe80d.tar.gz
spack-1ce0c1b5568228e2c273874bd4e9bf0834dbe80d.tar.bz2
spack-1ce0c1b5568228e2c273874bd4e9bf0834dbe80d.tar.xz
spack-1ce0c1b5568228e2c273874bd4e9bf0834dbe80d.zip
Fix python3 compatibility bug in spack edit command (#6748)
In Python 2, filter() returns a list, but in Python 3, filter() returns an iterator, and iterators have no length.
-rw-r--r--lib/spack/spack/cmd/edit.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/spack/spack/cmd/edit.py b/lib/spack/spack/cmd/edit.py
index 3e88a13389..5468692391 100644
--- a/lib/spack/spack/cmd/edit.py
+++ b/lib/spack/spack/cmd/edit.py
@@ -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'