diff options
Diffstat (limited to 'scripts')
-rwxr-xr-x | scripts/testdynamic.py | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/scripts/testdynamic.py b/scripts/testdynamic.py index c47ff9feb..1fa0ea295 100755 --- a/scripts/testdynamic.py +++ b/scripts/testdynamic.py @@ -1,6 +1,6 @@ #!/usr/bin/env python # -*- coding: utf-8 -import Ice, IcePy, sys, tempfile +import Ice, IcePy, sys, tempfile, os ice = Ice.initialize(sys.argv) @@ -9,13 +9,16 @@ proxy = ice.stringToProxy('Meta:tcp -h 127.0.0.1 -p 6502') try: slice = IcePy.Operation('getSlice', Ice.OperationMode.Idempotent, Ice.OperationMode.Idempotent, True, (), (), (), IcePy._t_string, ()).invoke(proxy, ((), None)) - slicefile = tempfile.NamedTemporaryFile(suffix = '.ice') + (slicefiledesc, slicefilepath) = tempfile.mkstemp(suffix = '.ice') + slicefile = os.fdopen(slicefiledesc, 'w') slicefile.write(slice) slicefile.flush() - Ice.loadSlice('', ['-I' + Ice.getSliceDir(), slicefile.name]) + Ice.loadSlice('', ['-I' + Ice.getSliceDir(), slicefilepath]) slicefile.close() + os.remove(slicefilepath) + print 'Using dynamic slice' -except: +except Exception: Ice.loadSlice('', ['-I' + Ice.getSliceDir(), 'Murmur.ice']) print 'Using bundled slice' |