diff --git a/app_brltty_es.py b/app_brltty_es.py
index 8316901..a1b758b 100644
--- a/app_brltty_es.py
+++ b/app_brltty_es.py
@@ -18,7 +18,7 @@
 # In the other direction we send back indexes to track the current
 # listening position.
 
-import os, sys, struct
+import os, sys, struct, errno
 
 import setencoding
 import tracing
@@ -44,7 +44,7 @@ class AppFeed:
             sys.stdout.write(d)
             sys.stdout.flush()
         except IOError, x:
-            if x.errno == 32:
+            if x.errno == errno.EPIPE:
                 trace('Exit on broken pipe')
                 sys.exit(0)
             else:
diff --git a/app_shell.py b/app_shell.py
index 3bb8b2d..fdbff2c 100644
--- a/app_shell.py
+++ b/app_shell.py
@@ -17,7 +17,7 @@
 # EOF causes the tts program to exit.
 # This interface is meant to be simple, not feature-full.
 
-import os, sys, fcntl
+import os, sys, fcntl, errno
 
 import setencoding
 import tracing
@@ -56,7 +56,7 @@ class AppFeed:
             try:
                 input = sys.stdin.read()
             except IOError, x:
-                if x.errno == 11:
+                if x.errno == errno.EAGAIN:
                     return 'M',None
                 raise
             if input == '':
diff --git a/mbrola_prog.py b/mbrola_prog.py
index b3ad7d6..633cf08 100644
--- a/mbrola_prog.py
+++ b/mbrola_prog.py
@@ -12,7 +12,7 @@
 
 # This module wraps up the details of managing a pipe to the MBROLA executable.
 
-import os, fcntl, signal, popen2, struct, time
+import os, fcntl, signal, popen2, struct, time, errno
 from select import select
 from profiling import *
 
@@ -91,7 +91,7 @@ class Mbrola:
         try:
             s = self.p.childerr.read()
         except IOError, x:
-            if x.errno == 11:
+            if x.errno == errno.EAGAIN:
                 return
             raise
         if s:
@@ -131,7 +131,7 @@ class Mbrola:
         try:
             sound = self.p.fromchild.read()
         except IOError, x:
-            if x.errno == 11:
+            if x.errno == errno.EAGAIN:
                 return '', 0
             raise
         if self.finished:
diff --git a/sndoutput.py b/sndoutput.py
index 5b8274f..a853a10 100644
--- a/sndoutput.py
+++ b/sndoutput.py
@@ -17,7 +17,7 @@
 
 import ossaudiodev
 from threading import *
-import struct, sys, time, array, fcntl
+import struct, sys, time, array, fcntl, errno
 
 import tracing
 def trace(msg):
@@ -126,7 +126,7 @@ class SndOutput(Thread):
                     self.dsp = ossaudiodev.open(config.snd_dev, 'w')
                     break
                 except IOError, x:
-                    if x.errno != 16:
+                    if x.errno != errno.EBUSY:
                         raise
                     trace('device is busy')
                     if self.bufsize==-1 and time.time() -start > 4.0:
@@ -143,7 +143,7 @@ class SndOutput(Thread):
         try:
             r = self.dsp.write(b)
         except IOError, x:
-            if x.errno != 11:
+            if x.errno != errno.EAGAIN:
                 raise
             r = 0
         self.lock.acquire()
