Page MenuHome

IPython.embed() throws RuntimeError
Open, Confirmed, LowPublic


System Information
Operating system: Win 10 X64
Graphics card: GTX 1070

Blender Version
Broken: blender-2.80.0-git.1fc75dbbceea-windows64

Short description of error
Based on, it is recommended that one can use Ipython in the internal terminal

Firing these commands throws bunch of errors in Blender.

Bear in mind that I have Ipython and notebook installed properly (system wide, which also Blender uses) and they seem to function as expected under regular Python/Cmd terminals, including the IPython.embed()

Exact steps for others to reproduce the error

Make sure Ipython is installed

Fire the commands below in Blender Py terminal

import IPython  (This does not produce any error, import succesfull)
IPython.embed() (alot of errors)
>>> import IPython
>>> IPython.embed()
Python 3.7.0 (default, Aug 26 2018, 16:05:01) [MSC v.1900 64 bit (AMD64)]
Type 'copyright', 'credits' or 'license' for more information
IPython 7.1.1 -- An enhanced Interactive Python. Type '?' for help.

RuntimeError                              Traceback (most recent call last)
C:\BLENDER_28\2.80\python\lib\ in runcode(self, code)
     88         """
     89         try:
---> 90             exec(code, self.locals)
     91         except SystemExit:
     92             raise

<blender_console> in <module>

C:\BLENDER_28\2.80\python\lib\site-packages\IPython\terminal\ in embed(**kwargs)
    387         frame.f_code.co_filename, frame.f_lineno), **kwargs)
    388     shell(header=header, stack_depth=2, compile_flags=compile_flags,
--> 389         _call_location_id='%s:%s' % (frame.f_code.co_filename, frame.f_lineno))
    390     InteractiveShellEmbed.clear_instance()
    391     #restore previous instance

C:\BLENDER_28\2.80\python\lib\site-packages\IPython\terminal\ in __call__(self, header, local_ns, module, dummy, stack_depth, global_ns, compile_flags, **kw)
    227         # our call and get the original caller's namespaces.
    228         self.mainloop(local_ns, module, stack_depth=stack_depth,
--> 229                       global_ns=global_ns, compile_flags=compile_flags)
    231         self.banner2 = self.old_banner2

C:\BLENDER_28\2.80\python\lib\site-packages\IPython\terminal\ in mainloop(self, local_ns, module, stack_depth, display_banner, global_ns, compile_flags)
    323         with self.builtin_trap, self.display_trap:
--> 324             self.interact()
    326         # now, purge out the local namespace of IPython's hidden variables.

C:\BLENDER_28\2.80\python\lib\site-packages\IPython\terminal\ in interact(self, display_banner)
    472             try:
--> 473                 code = self.prompt_for_code()
    474             except EOFError:
    475                 if (not self.confirm_exit) \

C:\BLENDER_28\2.80\python\lib\site-packages\IPython\terminal\ in prompt()
    248             def prompt():
    249                 prompt_text = "".join(x[1] for x in self.prompts.in_prompt_tokens())
--> 250                 lines = [input(prompt_text)]
    251                 prompt_continuation = "".join(x[1] for x in self.prompts.continuation_prompt_tokens())
    252                 while self.check_complete('\n'.join(lines))[0] == 'incomplete':

C:\BLENDER_28\2.80\python\lib\site-packages\IPython\utils\ in input(prompt)
    152 # to forward requests to a frontend.
    153 def input(prompt=''):
--> 154     return builtin_mod.input(prompt)
    156 builtin_mod_name = "builtins"

RuntimeError: input(): lost sys.stdin



Event Timeline

OS: Win 10, Blender a4e4d9f0ab89, IPython from Anaconda distribution


In the middle of a script you may want to inspect some variables, run some function and generally dig about to see whats going on.

It doesn't work in Embedded Python Console, but does work inside a script.

  1. Open Blender from a terminal (or click Window -> Toggle System Console)
  2. Open Text Editor -> New
  3. Paste import IPython; IPython.embed()
  4. Click Run Script (Alt P)
  5. IPython shell appears in the system console
  6. Type quit() when you want to go back to the Blender UI
Campbell Barton (campbellbarton) lowered the priority of this task from Needs Triage by Developer to Confirmed, Low.Feb 1 2019, 11:49 AM