~ampelbein/ubuntu/natty/pyserial/lp-715766

« back to all changes in this revision

Viewing changes to examples/scan.py

  • Committer: Bazaar Package Importer
  • Author(s): Matthias Klose
  • Date: 2011-01-25 07:59:17 UTC
  • mfrom: (3.1.5 experimental)
  • Revision ID: james.westby@ubuntu.com-20110125075917-m132a8pxfff5a7sf
Tags: 2.5-1
* New upstream version. Closes: #520618.
* Build a python3-serial package.
* Don't use string exception in miniterm.py. Closes: #585328.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
#!/usr/bin/env python
2
 
"""Scan for serial ports.
3
 
Part of pySerial (http://pyserial.sf.net)  (C)2002-2003 <cliechti@gmx.net>
 
1
#! /usr/bin/env python
 
2
"""\
 
3
Scan for serial ports.
 
4
 
 
5
Part of pySerial (http://pyserial.sf.net)
 
6
(C) 2002-2003 <cliechti@gmx.net>
4
7
 
5
8
The scan function of this module tries to open each port number
6
9
from 0 to 255 and it builds a list of those ports where this was
16
19
        try:
17
20
            s = serial.Serial(i)
18
21
            available.append( (i, s.portstr))
19
 
            s.close()   #explicit close 'cause of delayed GC in java
 
22
            s.close()   # explicit close 'cause of delayed GC in java
20
23
        except serial.SerialException:
21
24
            pass
22
25
    return available