bin/interactive.py

Fri, 18 May 2018 00:04:54 +0200

author
David Douard <david.douard@logilab.fr>
date
Fri, 18 May 2018 00:04:54 +0200
changeset 94
1ac1457af83f
parent 83
e90e7b6b876e
permissions
-rw-r--r--

[readme] write a more meaningful README file

83
e90e7b6b876e add an interactive session helper file
David Douard <david.douard@logilab.fr>
parents:
diff changeset
1 #!/usr/bin/python
e90e7b6b876e add an interactive session helper file
David Douard <david.douard@logilab.fr>
parents:
diff changeset
2 import sys
e90e7b6b876e add an interactive session helper file
David Douard <david.douard@logilab.fr>
parents:
diff changeset
3 import os
e90e7b6b876e add an interactive session helper file
David Douard <david.douard@logilab.fr>
parents:
diff changeset
4 import signal
e90e7b6b876e add an interactive session helper file
David Douard <david.douard@logilab.fr>
parents:
diff changeset
5 import time
e90e7b6b876e add an interactive session helper file
David Douard <david.douard@logilab.fr>
parents:
diff changeset
6
e90e7b6b876e add an interactive session helper file
David Douard <david.douard@logilab.fr>
parents:
diff changeset
7 try:
e90e7b6b876e add an interactive session helper file
David Douard <david.douard@logilab.fr>
parents:
diff changeset
8 from pygpibtoolkit.gpibcontroller import GPIBController
e90e7b6b876e add an interactive session helper file
David Douard <david.douard@logilab.fr>
parents:
diff changeset
9 except ImportError:
e90e7b6b876e add an interactive session helper file
David Douard <david.douard@logilab.fr>
parents:
diff changeset
10 sys.path.append(os.path.join(os.path.dirname(os.path.abspath(__file__)), ".."))
e90e7b6b876e add an interactive session helper file
David Douard <david.douard@logilab.fr>
parents:
diff changeset
11 from pygpibtoolkit.gpibcontroller import GPIBController
e90e7b6b876e add an interactive session helper file
David Douard <david.douard@logilab.fr>
parents:
diff changeset
12 import pygpibtoolkit.HP3562A
e90e7b6b876e add an interactive session helper file
David Douard <david.douard@logilab.fr>
parents:
diff changeset
13 import pygpibtoolkit.HP3456
e90e7b6b876e add an interactive session helper file
David Douard <david.douard@logilab.fr>
parents:
diff changeset
14 import pygpibtoolkit.HP8904
e90e7b6b876e add an interactive session helper file
David Douard <david.douard@logilab.fr>
parents:
diff changeset
15 from pygpibtoolkit.prologix import GPIB
e90e7b6b876e add an interactive session helper file
David Douard <david.douard@logilab.fr>
parents:
diff changeset
16
e90e7b6b876e add an interactive session helper file
David Douard <david.douard@logilab.fr>
parents:
diff changeset
17
e90e7b6b876e add an interactive session helper file
David Douard <david.douard@logilab.fr>
parents:
diff changeset
18 import optparse
e90e7b6b876e add an interactive session helper file
David Douard <david.douard@logilab.fr>
parents:
diff changeset
19 opt = optparse.OptionParser("A simple tool for detecting connected GPIB devices")
e90e7b6b876e add an interactive session helper file
David Douard <david.douard@logilab.fr>
parents:
diff changeset
20 opt.add_option('-d', '--device', default="/dev/ttyUSB0",
e90e7b6b876e add an interactive session helper file
David Douard <david.douard@logilab.fr>
parents:
diff changeset
21 dest="device",
e90e7b6b876e add an interactive session helper file
David Douard <david.douard@logilab.fr>
parents:
diff changeset
22 help="Device of connected Prologix GPIB bundle [/dev/ttyUSB0]",)
e90e7b6b876e add an interactive session helper file
David Douard <david.douard@logilab.fr>
parents:
diff changeset
23 options, argv = opt.parse_args(sys.argv)
e90e7b6b876e add an interactive session helper file
David Douard <david.douard@logilab.fr>
parents:
diff changeset
24
e90e7b6b876e add an interactive session helper file
David Douard <david.douard@logilab.fr>
parents:
diff changeset
25 cnx = GPIB(device=options.device)
e90e7b6b876e add an interactive session helper file
David Douard <david.douard@logilab.fr>
parents:
diff changeset
26 c = GPIBController(cnx)
e90e7b6b876e add an interactive session helper file
David Douard <david.douard@logilab.fr>
parents:
diff changeset
27
e90e7b6b876e add an interactive session helper file
David Douard <david.douard@logilab.fr>
parents:
diff changeset
28
e90e7b6b876e add an interactive session helper file
David Douard <david.douard@logilab.fr>
parents:
diff changeset
29

mercurial