Skip to content

Commit 4c1bf15

Browse files
committed
Add check to ignore empty lines in 'pip list -l' output
1 parent c2cfe83 commit 4c1bf15

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

mbed/mbed.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1449,7 +1449,7 @@ def check_requirements(self, show_warning=False):
14491449
try:
14501450
with open(os.path.join(req_path, req_file), 'r') as f:
14511451
pkg_list = pquery([python_cmd, '-m', 'pip', 'list', '-l']) or ""
1452-
installed_packages = [re.sub(r'-', '_', pkg.split()[0].lower()) for pkg in pkg_list.splitlines()]
1452+
installed_packages = [re.sub(r'-', '_', pkg.split()[0].lower()) for pkg in pkg_list.splitlines() if len(pkg.split())]
14531453
for line in f.read().splitlines():
14541454
pkg = re.sub(r'-', '_', re.sub(r'^([\w-]+).*$', r'\1', line).lower())
14551455
if not pkg in installed_packages:

0 commit comments

Comments
 (0)