diff options
-rw-r--r-- | pyserial/serial/serialcli.py | 14 | ||||
-rw-r--r-- | pyserial/serial/serialjava.py | 4 | ||||
-rw-r--r-- | pyserial/serial/serialposix.py | 9 | ||||
-rw-r--r-- | pyserial/serial/serialutil.py | 12 | ||||
-rw-r--r-- | pyserial/serial/serialwin32.py | 8 | ||||
-rw-r--r-- | pyserial/serial/sermsdos.py | 23 | ||||
-rw-r--r-- | pyserial/setup.py | 7 |
7 files changed, 32 insertions, 45 deletions
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 @@ class Serial(SerialBase): #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 @@ if __name__ == '__main__': 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 @@ elif plat[:3] == 'aix': # AIX 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 @@ also add the device name of the serial port and where the 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 @@ if __name__ == '__main__': 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 @@ class SerialBase(FileLike): 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 @@ class Serial(SerialBase): 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 @@ class Serial(SerialBase): # 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 @@ BAUD_RATES = { 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 @@ class Serial(serialutil.FileLike): ): 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 @@ class Serial(serialutil.FileLike): """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 @@ class Serial(serialutil.FileLike): self.retry , self.filename), ' ') if __name__ == '__main__': - print __name__ s = Serial(0) - print s - - - - - - - - - - - - - + sys.stdio.write('%s %s\n' % (__name__, s)) diff --git a/pyserial/setup.py b/pyserial/setup.py index fb3a9cb..ac0d8fd 100644 --- a/pyserial/setup.py +++ b/pyserial/setup.py @@ -1,12 +1,13 @@ # setup.py +import sys + try: from setuptools import setup except ImportError: - print "standart distutils" + sys.stdout.write("standard distutils\n") from distutils.core import setup else: - print "setuptools" -import sys + sys.stdout.write("setuptools\n") #windows installer: # python setup.py bdist_wininst |