'except FileNotFoundError' instead of ENOENT check
This commit is contained in:
parent
5aa35a1208
commit
b3983f5ef8
@ -22,7 +22,6 @@
|
||||
|
||||
import collections
|
||||
import copy
|
||||
import errno
|
||||
import functools
|
||||
import grp
|
||||
import itertools
|
||||
@ -1008,8 +1007,8 @@ class Qubes(qubes.PropertyHolder):
|
||||
try:
|
||||
fd = os.open(self._store,
|
||||
os.O_RDWR | (os.O_CREAT * int(for_save)))
|
||||
except OSError as e:
|
||||
if not for_save and e.errno == errno.ENOENT:
|
||||
except FileNotFoundError:
|
||||
if not for_save:
|
||||
raise qubes.exc.QubesException(
|
||||
'Qubes XML store {!r} is missing; '
|
||||
'use qubes-create tool'.format(self._store))
|
||||
|
@ -24,7 +24,6 @@ from __future__ import absolute_import
|
||||
|
||||
import asyncio
|
||||
import base64
|
||||
import errno
|
||||
import grp
|
||||
import os
|
||||
import os.path
|
||||
@ -1461,11 +1460,8 @@ class QubesVM(qubes.vm.mix.net.NetVMMixin, qubes.vm.BaseVM):
|
||||
try:
|
||||
# TODO: make it async?
|
||||
shutil.rmtree(self.dir_path)
|
||||
except OSError as e:
|
||||
if e.errno == errno.ENOENT:
|
||||
pass
|
||||
else:
|
||||
raise
|
||||
except FileNotFoundError:
|
||||
pass
|
||||
yield from self.storage.remove()
|
||||
|
||||
@asyncio.coroutine
|
||||
|
Loading…
Reference in New Issue
Block a user