Commit 3f24877e authored by Łukasz Nowak's avatar Łukasz Nowak

monitor: Support python 3.7+

os.errno does not exists since python 3.7
parent c3eeed9d
...@@ -4,6 +4,10 @@ ...@@ -4,6 +4,10 @@
from __future__ import print_function from __future__ import print_function
import sys import sys
try:
import errno
except ImportError:
from os import errno
import os import os
import stat import stat
import json import json
...@@ -53,7 +57,7 @@ def mkdirAll(path): ...@@ -53,7 +57,7 @@ def mkdirAll(path):
try: try:
os.makedirs(path) os.makedirs(path)
except OSError as e: except OSError as e:
if e.errno == os.errno.EEXIST and os.path.isdir(path): if e.errno == errno.EEXIST and os.path.isdir(path):
pass pass
else: raise else: raise
...@@ -67,7 +71,7 @@ def createSymlink(source, destination): ...@@ -67,7 +71,7 @@ def createSymlink(source, destination):
try: try:
os.symlink(source, destination) os.symlink(source, destination)
except OSError as e: except OSError as e:
if e.errno != os.errno.EEXIST: if e.errno != errno.EEXIST:
raise raise
class Monitoring(object): class Monitoring(object):
...@@ -201,7 +205,7 @@ class Monitoring(object): ...@@ -201,7 +205,7 @@ class Monitoring(object):
mkdirAll(dirname) # could also raise OSError mkdirAll(dirname) # could also raise OSError
os.symlink(path, os.path.join(dirname, os.path.basename(path))) os.symlink(path, os.path.join(dirname, os.path.basename(path)))
except OSError as e: except OSError as e:
if e.errno != os.errno.EEXIST: if e.errno != errno.EEXIST:
raise raise
def getMonitorTitleFromUrl(self, monitor_url): def getMonitorTitleFromUrl(self, monitor_url):
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment