mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
close sysfs file
This commit is contained in:
parent
c3925db827
commit
b37a4b1f7a
@ -530,7 +530,8 @@ class Device(DeviceConfig, DevicePlugin):
|
||||
if not os.access(sz, os.R_OK):
|
||||
continue
|
||||
try:
|
||||
sz = int(open(sz, 'rb').read().decode('utf-8'))
|
||||
with open(sz, 'rb') as szf:
|
||||
sz = int(szf.read().decode('utf-8'))
|
||||
except:
|
||||
continue
|
||||
if sz > 0:
|
||||
|
Loading…
x
Reference in New Issue
Block a user