remove print and replace with stdio writes
diff --git a/pyserial/serial/serialcli.py b/pyserial/serial/serialcli.py
index f205502..e609540 100644
--- a/pyserial/serial/serialcli.py
+++ b/pyserial/serial/serialcli.py
@@ -233,17 +233,19 @@
 
 #Nur Testfunktion!!
 if __name__ == '__main__':
+    import sys
+
     s = Serial(0)
-    print s
-    
+    sys.stdio.write('%s\n' % s)
+
     s = Serial()
-    print s
-    
-    
+    sys.stdio.write('%s\n' % s)
+
+
     s.baudrate = 19200
     s.databits = 7
     s.close()
     s.port = 0
     s.open()
-    print s
+    sys.stdio.write('%s\n' % s)
 
diff --git a/pyserial/serial/serialjava.py b/pyserial/serial/serialjava.py
index ac7c595..2dbaad6 100644
--- a/pyserial/serial/serialjava.py
+++ b/pyserial/serial/serialjava.py
@@ -233,8 +233,8 @@
     s.flushInput()
     s.flushOutput()
     s.write('hello')
-    print repr(s.read(5))
-    print s.inWaiting()
+    sys.stdio.write('%r\n' % s.read(5))
+    sys.stdio.write('%s\n' % s.inWaiting())
     del s
 
 
diff --git a/pyserial/serial/serialposix.py b/pyserial/serial/serialposix.py
index 71b73b5..c12a27b 100644
--- a/pyserial/serial/serialposix.py
+++ b/pyserial/serial/serialposix.py
@@ -69,7 +69,8 @@
 
 else:
     #platform detection has failed...
-    print """don't know how to number ttys on this system.
+    sys.stderr.write("""\
+don't know how to number ttys on this system.
 ! Use an explicit path (eg /dev/ttyS1) or send this information to
 ! the author of this module:
 
@@ -81,7 +82,7 @@
 counting starts for the first serial port.
 e.g. 'first serial port: /dev/ttyS0'
 and with a bit luck you can get this module running...
-""" % (sys.platform, os.name, VERSION)
+""" % (sys.platform, os.name, VERSION))
     # no exception, just continue with a brave attempt to build a device name
     # even if the device name is not correct for the platform it has chances
     # to work using a string with the real device name as port parameter.
@@ -496,7 +497,7 @@
     s.flushInput()
     s.flushOutput()
     s.write('hello')
-    print repr(s.read(5))
-    print s.inWaiting()
+    sys.stdio.write('%r\n' % s.read(5))
+    sys.stdio.write('%s\n' % s.inWaiting())
     del s
 
diff --git a/pyserial/serial/serialutil.py b/pyserial/serial/serialutil.py
index f9c53f2..9097d04 100644
--- a/pyserial/serial/serialutil.py
+++ b/pyserial/serial/serialutil.py
@@ -392,9 +392,9 @@
 
 if __name__ == '__main__':
     s = SerialBase()
-    print s.portstr
-    print s.getSupportedBaudrates()
-    print s.getSupportedByteSizes()
-    print s.getSupportedParities()
-    print s.getSupportedStopbits()
-    print s
+    sys.stdio.write('port name:  %s\n' % s.portstr)
+    sys.stdio.write('baud rates: %s\n' % s.getSupportedBaudrates())
+    sys.stdio.write('byte sizes: %s\n' % s.getSupportedByteSizes())
+    sys.stdio.write('parities:   %s\n' % s.getSupportedParities())
+    sys.stdio.write('stop bits:  %s\n' % s.getSupportedStopbits())
+    sys.stdio.write('%s\n' % s)
diff --git a/pyserial/serial/serialwin32.py b/pyserial/serial/serialwin32.py
index e70eb34..656c5dd 100644
--- a/pyserial/serial/serialwin32.py
+++ b/pyserial/serial/serialwin32.py
@@ -231,7 +231,6 @@
         if not self.hComPort: raise portNotOpenError
         if not isinstance(data, str):
             raise TypeError('expected str, got %s' % type(data))
-        #print repr(s),
         if data:
             #~ win32event.ResetEvent(self._overlappedWrite.hEvent)
             err, n = win32file.WriteFile(self.hComPort, data, self._overlappedWrite)
@@ -329,16 +328,15 @@
 # Nur Testfunktion!!
 if __name__ == '__main__':
     s = Serial(0)
-    print s
+    sys.stdout.write("%s\n" % s)
 
     s = Serial()
-    print s
-
+    sys.stdout.write("%s\n" % s)
 
     s.baudrate = 19200
     s.databits = 7
     s.close()
     s.port = 0
     s.open()
-    print s
+    sys.stdout.write("%s\n" % s)
 
diff --git a/pyserial/serial/sermsdos.py b/pyserial/serial/sermsdos.py
index a516118..d4b65dd 100644
--- a/pyserial/serial/sermsdos.py
+++ b/pyserial/serial/sermsdos.py
@@ -50,7 +50,7 @@
                 4800: "48",
                 9600: "96",
                 19200: "19"}
-                
+
 (PARITY_NONE, PARITY_EVEN, PARITY_ODD, PARITY_MARK,
 PARITY_SPACE) = range(5)
 (STOPBITS_ONE, STOPBITS_ONEANDAHALF,
@@ -91,10 +91,10 @@
                  ):
 
         if type(port) == type(''):
-        #strings are taken directly
+        # strings are taken directly
             self.portstr = port
         else:
-        #numbers are transformed to a string
+        # numbers are transformed to a string
             self.portstr = device(port+1)
 
         self.baud = BAUD_RATES[baudrate]
@@ -145,7 +145,6 @@
         """Read num bytes from serial port"""
         handle = os.open(self.portstr,
         os.O_RDONLY | os.O_BINARY)
-        # print os.fstat(handle)
         rv = os.read(handle, num)
         os.close(handle)
         return rv
@@ -197,19 +196,5 @@
         self.retry , self.filename), ' ')
 
 if __name__ == '__main__':
-    print __name__
     s = Serial(0)
-    print s
-
-
-
-
-
-
-
-
-
-
-
-
-
+    sys.stdio.write('%s %s\n' % (__name__, s))