summaryrefslogtreecommitdiff
path: root/pyserial/serial/__init__.py
blob: 59dc1b178b51025080823877d8cb81cac94c6883 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#!/usr/bin/env python 
#portable serial port access with python
#this is a wrapper module for different platform implementations
#
# (C)2001-2002 Chris Liechti <cliechti@gmx.net>
# this is distributed under a free software license, see license.txt

VERSION = '2.4'

import sys

try:
    import os
except ImportError:
    if sys.name == 'cli':
        from serialcli import *
    else:
        raise Exception("Sorry: no implementation for your platform ('%s') available" % os.name)
else:
    #chose an implementation, depending on os
    if os.name == 'nt': #sys.platform == 'win32':
        from serialwin32 import *
    elif os.name == 'posix':
        from serialposix import *
    elif os.name == 'java':
        from serialjava import *
    else:
        raise Exception("Sorry: no implementation for your platform ('%s') available" % os.name)