Don't hardcode errno constant

The value of ENOENT is architecture-dependent, so don't assume
it's always 2.
This commit is contained in:
Jakub Wilk 2017-04-23 23:28:32 +02:00
parent 80f77aea4d
commit 95a868bb50

View file

@ -18,6 +18,7 @@
from __future__ import division, absolute_import, print_function
import errno
import hashlib
import json
import os
@ -142,8 +143,8 @@ class AcousticBrainzSubmitPlugin(plugins.BeetsPlugin):
try:
os.remove(filename)
except OSError as e:
# errno 2 means file does not exist, just ignore this error.
if e.errno != 2:
# ENOENT means file does not exist, just ignore this error.
if e.errno != errno.ENOENT:
raise
def _submit_data(self, item, data):