1

In a normal ipython notebook or repl session, I can refer to previously-run cells using the _# notation.

However, this is not possible when using cell magics such as %%perl or %%bash because these cells do not have entries in _oh. Nor can I find a way for any two languages to refer to values in the other's namespace.

Does anyone know a way to move information between cells that use different languages, other than using an external file?

Rache
  • 236
  • 2
  • 11
  • 1
    They should still be in the input history; you're right that their output is not part of the output history. – Thomas K Aug 14 '16 at 17:26
  • You're right, and I removed the reference to _ih. It was immaterial to my problem. – Rache Aug 15 '16 at 19:49

1 Answers1

2

I found a method that involves using multiple cell magics.

%%capture perl_out
%%perl

will create a CapturedIO object and allow str(perl_out) to be used in a python cell. A fuller example is in this gist.

Rache
  • 236
  • 2
  • 11