diff options
| author | Guido van Rossum <guido@python.org> | 1998-03-26 22:14:20 (GMT) |
|---|---|---|
| committer | Guido van Rossum <guido@python.org> | 1998-03-26 22:14:20 (GMT) |
| commit | 548703a1b81f6adf68a3dd4b497a88f5c4a31f4a (patch) | |
| tree | 8fc46e5faa2a7e82e6748995c555d7fe0b781449 /Lib/dos-8x3/test_sun.py | |
| parent | 65e5399081e23d7b1efbf685096c65d0a0ab912b (diff) | |
| download | cpython-548703a1b81f6adf68a3dd4b497a88f5c4a31f4a.zip cpython-548703a1b81f6adf68a3dd4b497a88f5c4a31f4a.tar.gz cpython-548703a1b81f6adf68a3dd4b497a88f5c4a31f4a.tar.bz2 | |
The usual.
Diffstat (limited to 'Lib/dos-8x3/test_sun.py')
| -rw-r--r-- | Lib/dos-8x3/test_sun.py | 25 |
1 files changed, 15 insertions, 10 deletions
diff --git a/Lib/dos-8x3/test_sun.py b/Lib/dos-8x3/test_sun.py index aa85752..1438c09 100644 --- a/Lib/dos-8x3/test_sun.py +++ b/Lib/dos-8x3/test_sun.py @@ -3,24 +3,29 @@ import sunaudiodev import os def findfile(file): - if os.path.isabs(file): return file - import sys - for dn in sys.path: - fn = os.path.join(dn, file) - if os.path.exists(fn): return fn - return file + if os.path.isabs(file): return file + import sys + path = sys.path + try: + path = [os.path.dirname(__file__)] + path + except NameError: + pass + for dn in path: + fn = os.path.join(dn, file) + if os.path.exists(fn): return fn + return file def play_sound_file(path): fp = open(path, 'r') data = fp.read() fp.close() try: - a = sunaudiodev.open('w') + a = sunaudiodev.open('w') except sunaudiodev.error, msg: - raise TestFailed, msg + raise TestFailed, msg else: - a.write(data) - a.close() + a.write(data) + a.close() def test(): play_sound_file(findfile('audiotest.au')) |
