Fix #1944 : Use errno constants for portability

This commit is contained in:
Cristian Greco 2011-11-20 15:27:17 +00:00 committed by Calum Lind
commit d8560f5c25
2 changed files with 7 additions and 5 deletions

View file

@ -790,7 +790,8 @@ class TorrentManager(component.Component):
os.removedirs(os.path.join(root, name)) os.removedirs(os.path.join(root, name))
log.debug("Removed Empty Folder %s", os.path.join(root, name)) log.debug("Removed Empty Folder %s", os.path.join(root, name))
except OSError, (errno, strerror): except OSError, (errno, strerror):
if errno == 39: from errno import ENOTEMPTY
if errno == ENOTEMPTY:
# Error raised if folder is not empty # Error raised if folder is not empty
log.debug("%s", strerror) log.debug("%s", strerror)

View file

@ -409,7 +409,8 @@ class ConnectionManager(component.Component):
try: try:
return client.start_daemon(port, config) return client.start_daemon(port, config)
except OSError, e: except OSError, e:
if e.errno == 2: from errno import ENOENT
if e.errno == ENOENT:
dialogs.ErrorDialog( dialogs.ErrorDialog(
_("Unable to start daemon!"), _("Unable to start daemon!"),
_("Deluge cannot find the 'deluged' executable, it is likely \ _("Deluge cannot find the 'deluged' executable, it is likely \