Pycharm - Python Console
<p>I am testing my python code in the console window.</p>

<p>It is not allowing me to enter any code and instead it passes this error message:</p>

<pre><code>/Library/Frameworks/Python.framework/Versions/3.5/bin/python3.5 /Applications/PyCharm.app/Contents/helpers/pydev/pydevconsole.py 55724 55725
PyDev console: starting.

Traceback (most recent call last):
  File "/Applications/PyCharm.app/Contents/helpers/pydev/pydevconsole.py", line 512, in &lt;module&gt;
    pydevconsole.start_server(pydev_localhost.get_localhost(), int(port), int(client_port))
  File "/Applications/PyCharm.app/Contents/helpers/pydev/pydevconsole.py", line 353, in start_server
    process_exec_queue(interpreter)
  File "/Applications/PyCharm.app/Contents/helpers/pydev/pydevconsole.py", line 181, in process_exec_queue
    from _pydev_bundle.pydev_import_hook import import_hook_manager
  File "/Applications/PyCharm.app/Contents/helpers/pydev/_pydev_bundle/pydev_import_hook.py", line 29, in &lt;module&gt;
    import_hook_manager = ImportHookManager(__name__ + '.import_hook', builtins.__import__)
NameError: name 'ImportHookManager' is not defined

Process finished with exit code 1
</code></pre>

<p>I understand that it must be an error in my settings but I am not sure how to rectify it</p>

<p>This is how your <code>pydev_import_hook.py</code> should look like:</p>

<pre><code>import sys
from _pydevd_bundle.pydevd_constants import dict_contains
from types import ModuleType


class ImportHookManager(ModuleType):
    def __init__(self, name, system_import):
        ModuleType.__init__(self, name)
        self._system_import = system_import
        self._modules_to_patch = {}

    def add_module_name(self, module_name, activate_function):
        self._modules_to_patch[module_name] = activate_function

    def do_import(self, name, *args, **kwargs):
        activate_func = None
        if dict_contains(self._modules_to_patch, name):
            activate_func = self._modules_to_patch.pop(name)

        module = self._system_import(name, *args, **kwargs)
        try:
            if activate_func:
                activate_func() #call activate function
        except:
            sys.stderr.write("Matplotlib support failed\n")
        return module

try:
    import __builtin__ as builtins
except ImportError:
    import builtins

import_hook_manager = ImportHookManager(__name__ + '.import_hook', builtins.__import__)
builtins.__import__ = import_hook_manager.do_import
sys.modules[import_hook_manager.__name__] = import_hook_manager
del builtins
</code></pre>

python console pycharm