summaryrefslogtreecommitdiff
path: root/scripts/Expect.py
diff options
context:
space:
mode:
authorMatthew Newhook <matthew@zeroc.com>2009-03-16 22:39:00 -0230
committerMatthew Newhook <matthew@zeroc.com>2009-03-16 22:39:00 -0230
commit661f0b848fb93a93e23c33246a9259ed42059284 (patch)
tree2badd36e9642590416900f0e101e7cf6d637f564 /scripts/Expect.py
parentbug 3535 - minor fixes to Java servants (diff)
downloadice-661f0b848fb93a93e23c33246a9259ed42059284.tar.bz2
ice-661f0b848fb93a93e23c33246a9259ed42059284.tar.xz
ice-661f0b848fb93a93e23c33246a9259ed42059284.zip
http://bugzilla.zeroc.com/bugzilla/show_bug.cgi?id=3842 - ctypes not in python 2.5 in x64 windows. Also added code to print environment variables of interest.
Diffstat (limited to 'scripts/Expect.py')
-rwxr-xr-xscripts/Expect.py23
1 files changed, 17 insertions, 6 deletions
diff --git a/scripts/Expect.py b/scripts/Expect.py
index 2ce0cd55b51..1b488d5d486 100755
--- a/scripts/Expect.py
+++ b/scripts/Expect.py
@@ -23,8 +23,13 @@ __all__ = ["Expect", "EOF", "TIMEOUT" ]
win32 = (sys.platform == "win32")
if win32:
- # We use this to remove the reliance on win32api.
- import ctypes
+ # We use this to remove the reliance on win32api. Unfortunately,
+ # python 2.5 under 64 bit versions of windows doesn't have ctypes,
+ # hence we have to be prepared for that module not to be present.
+ try:
+ import ctypes
+ except ImportError:
+ pass
class EOF:
"""Raised when EOF is read from a child.
@@ -445,8 +450,11 @@ class Expect (object):
#
# Using the ctypes module removes the reliance on the
# python win32api
- #win32console.GenerateConsoleCtrlEvent(win32console.CTRL_BREAK_EVENT, self.p.pid)
- ctypes.windll.kernel32.GenerateConsoleCtrlEvent(1, self.p.pid) # 1 is CTRL_BREAK_EVENT
+ try:
+ #win32console.GenerateConsoleCtrlEvent(win32console.CTRL_BREAK_EVENT, self.p.pid)
+ ctypes.windll.kernel32.GenerateConsoleCtrlEvent(1, self.p.pid) # 1 is CTRL_BREAK_EVENT
+ except NameError:
+ pass
else:
os.kill(self.p.pid, signal.SIGINT)
except:
@@ -487,8 +495,11 @@ class Expect (object):
#
# Using the ctypes module removes the reliance on the
# python win32api
- ctypes.windll.kernel32.GenerateConsoleCtrlEvent(1, self.p.pid) # 1 is CTRL_BREAK_EVENT
- #win32console.GenerateConsoleCtrlEvent(win32console.CTRL_BREAK_EVENT, self.p.pid)
+ try:
+ #win32console.GenerateConsoleCtrlEvent(win32console.CTRL_BREAK_EVENT, self.p.pid)
+ ctypes.windll.kernel32.GenerateConsoleCtrlEvent(1, self.p.pid) # 1 is CTRL_BREAK_EVENT
+ except NameError:
+ pass
except:
traceback.print_exc(file=sys.stdout)
else: