diff --git a/deluge/core/torrentmanager.py b/deluge/core/torrentmanager.py
index 3f95bb0..c7e055e 100644
--- a/deluge/core/torrentmanager.py
+++ b/deluge/core/torrentmanager.py
@@ -847,7 +847,7 @@ def remove_empty_folders(self, torrent_id, folder):
                             os.removedirs(os.path.join(root, name))
                             log.debug("Removed Empty Folder %s", os.path.join(root, name))
                         except OSError as (errno, strerror):
-                            if errno == 39:
+                            if errno == errno.ENOTEMPTY:
                                 # Error raised if folder is not empty
                                 log.debug("%s", strerror)
 
diff --git a/deluge/plugins/AutoAdd/deluge/plugins/autoadd/core.py b/deluge/plugins/AutoAdd/deluge/plugins/autoadd/core.py
index a8405b4..0235e2e 100644
--- a/deluge/plugins/AutoAdd/deluge/plugins/autoadd/core.py
+++ b/deluge/plugins/AutoAdd/deluge/plugins/autoadd/core.py
@@ -268,7 +268,7 @@ def update_watchdir(self, watchdir_id):
                     try:
                         os.rename(filepath, copy_torrent_file)
                     except OSError, why:
-                        if why.errno == 18:
+                        if why.errno == errno.EXDEV:
                             # This can happen for different mount points
                             from shutil import copyfile
                             try:
diff --git a/deluge/ui/gtkui/connectionmanager.py b/deluge/ui/gtkui/connectionmanager.py
index a883976..91862dd 100644
--- a/deluge/ui/gtkui/connectionmanager.py
+++ b/deluge/ui/gtkui/connectionmanager.py
@@ -475,7 +475,7 @@ def start_daemon(self, port, config):
         try:
             return client.start_daemon(port, config)
         except OSError, e:
-            if e.errno == 2:
+            if e.errno == errno.ENOENT:
                 dialogs.ErrorDialog(
                     _("Unable to start daemon!"),
                     _("Deluge cannot find the 'deluged' executable, it is "

