1
0

file i/o: use 'with' keyword

This commit is contained in:
SomberNight
2017-11-12 14:33:46 +01:00
parent 8fcf1656d3
commit c65d01ea96
8 changed files with 22 additions and 20 deletions

View File

@@ -70,7 +70,8 @@ def _find_system_cameras():
if os.path.exists(device_root):
for device in os.listdir(device_root):
try:
name = open(os.path.join(device_root, device, 'name')).read()
with open(os.path.join(device_root, device, 'name')) as f:
name = f.read()
except IOError:
continue
name = name.strip('\n')