# How to get the full output from python using PyCall

**URL:** <https://discourse.julialang.org/t/how-to-get-the-full-output-from-python-using-pycall/35634>\
**Category:** New to Julia\
**Tags:** pycall\
**Created:** [March 6, 2020, 10:53am UTC](https://discourse.julialang.org/t/how-to-get-the-full-output-from-python-using-pycall/35634 "2020-03-06T10:53:33Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![zwwi](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/zwwi/32/11932_2.png) [@zwwi](https://discourse.julialang.org/u/zwwi)\
**Post date:** [March 6, 2020, 10:53am UTC](https://discourse.julialang.org/t/how-to-get-the-full-output-from-python-using-pycall/35634/1 "2020-03-06T10:53:33Z")

</div>

Hello,

I’m trying to use the iminuit package from python. However, I do not know whether it is possible to get all the output from python. Here is some simple code in python:

```julia
from iminuit import Minuit
def f(a, b):
    return a **2 + b** 2

pymin = Minuit(f, a=1, b=1, pedantic=False, print_level = 1)
pymin.migrad()

```

The output is:

 ![pyoutput](https://global.discourse-cdn.com/julialang/original/3X/2/6/26d280d31164c87d33d5e11e9d68376c209cdc39.png)

The julia code:

```julia
minuit = pyimport(:iminuit)
f(a, b) = a^2 + b^2
pyfun = py"lambda fun: lambda a, b: fun(a, b)"
fmin = minuit.Minuit(pyfun(f); a=1, b=1,pedantic=false, print_level = 1)
fmin.migrad()

```

The output is much less:

 ![jloutput](https://global.discourse-cdn.com/julialang/original/3X/7/7/778785062cbb560402414f5d6fb84ccff5695545.png)

How can I get the output like in python?

Thank you!

---

<div class="post-metadata">

**Author:** ![nilshg](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/nilshg/32/2283_2.png) [@nilshg](https://discourse.julialang.org/u/nilshg)\
**Post date:** [March 6, 2020, 10:55am UTC](https://discourse.julialang.org/t/how-to-get-the-full-output-from-python-using-pycall/35634/2 "2020-03-06T10:55:09Z")

</div>

Isn’t this all the same stuff (just badly formatted)?

---

<div class="post-metadata">

**Author:** ![zwwi](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/zwwi/32/11932_2.png) [@zwwi](https://discourse.julialang.org/u/zwwi)\
**Post date:** [March 6, 2020, 11:22am UTC](https://discourse.julialang.org/t/how-to-get-the-full-output-from-python-using-pycall/35634/3 "2020-03-06T11:22:54Z")

</div>

Indeed all values are obtained, but the “keys” are lost.

---

<div class="post-metadata">

**Author:** ![stevengj](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/stevengj/32/71_2.png) [@stevengj](https://discourse.julialang.org/u/stevengj)\
**Post date:** [March 6, 2020, 12:25pm UTC](https://discourse.julialang.org/t/how-to-get-the-full-output-from-python-using-pycall/35634/4 "2020-03-06T12:25:58Z")

</div>

> [@zwwi](#):
>
> fmin.migrad()

Try `pycall(fmin.migrad, PyObject)` to prevent PyCall from trying to convert the output to a native Julia tuple.

---

<div class="post-metadata">

**Author:** ![zwwi](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/zwwi/32/11932_2.png) [@zwwi](https://discourse.julialang.org/u/zwwi)\
**Post date:** [March 6, 2020, 12:59pm UTC](https://discourse.julialang.org/t/how-to-get-the-full-output-from-python-using-pycall/35634/5 "2020-03-06T12:59:04Z")

</div>

Thank you!
