Permalink
Browse files

Remove hard dependecy on ctypes.

Closes gh-1394.
  • Loading branch information...
bfroehle committed Feb 9, 2012
1 parent 0291d61 commit 215ae51f93eac0fab9036a2921196a2bce92348d
Showing with 9 additions and 2 deletions.
  1. +9 −2 IPython/lib/inputhook.py
View
@@ -14,10 +14,14 @@
# Imports
#-----------------------------------------------------------------------------
-import ctypes
+try:
+ import ctypes
+except ImportError:
+ ctypes = None
import os
import sys
-import warnings
+
+from IPython.utils.warn import warn
#-----------------------------------------------------------------------------
# Constants
@@ -98,6 +102,9 @@ class InputHookManager(object):
"""
def __init__(self):
+ if ctypes is None:
+ warn("IPython GUI event loop requires ctypes, %gui will not be available\n")
+ return
self.PYFUNC = ctypes.PYFUNCTYPE(ctypes.c_int)
self._apps = {}
self._reset()

0 comments on commit 215ae51

Please sign in to comment.