# Help debug python interface

**URL:** <https://discourse.julialang.org/t/help-debug-python-interface/115154>\
**Category:** General Usage\
**Tags:** python\
**Created:** [June 4, 2024, 7:39am UTC](https://discourse.julialang.org/t/help-debug-python-interface/115154 "2024-06-04T07:39:16Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![rveltz](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/rveltz/32/2707_2.png) [@rveltz](https://discourse.julialang.org/u/rveltz)\
**Post date:** [June 4, 2024, 7:39am UTC](https://discourse.julialang.org/t/help-debug-python-interface/115154/1 "2024-06-04T07:39:16Z")

</div>

Hi,

I am trying to provide a python wrapper for [BifurcationKit.jl](https://github.com/bifurcationkit/BifurcationKit.jl). The wrapper is located here [GitHub - bifurcationkit/bifurcationkitpy: Computation of bifurcation diagrams in python](https://github.com/bifurcationkit/bifurcationkitpy).

However, I cannot debug the error from python, the stacktraces are quite short (I guess this can be a problem too 😉 )

Can anyone help me run the [example1.ipynb](https://github.com/bifurcationkit/bifurcationkitpy/blob/main/example1.ipynb)? I should then be able to fill the gaps.

Thank you a lot for your help

---

<div class="post-metadata">

**Author:** ![cjdoris](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/cjdoris/32/213133_2.png) [@cjdoris](https://discourse.julialang.org/u/cjdoris)\
**Post date:** [June 4, 2024, 8:02am UTC](https://discourse.julialang.org/t/help-debug-python-interface/115154/2 "2024-06-04T08:02:13Z")

</div>

I’ve not run the notebook, but `record_from_solution` doesn’t look right. Firstly, there’s a comma missing so it’s not returning a named tuple. Secondly it completely ignores the arguments - the code in `seval` is run without passing in `x`.

Maybe you want `jl.seval("x->(x=x,)")[x[0]]`?

(It will be more efficient to cache that Julia function instead of creating it every time.)

---

<div class="post-metadata">

**Author:** ![rveltz](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/rveltz/32/2707_2.png) [@rveltz](https://discourse.julialang.org/u/rveltz)\
**Post date:** [June 4, 2024, 8:21am UTC](https://discourse.julialang.org/t/help-debug-python-interface/115154/3 "2024-06-04T08:21:47Z")

</div>

Thank you for your answer. It does not remove the error. In fact, if I remove `record_from_solution` from the defintion, the error is still the same

```python
u0 = [0.0]
p = bk.seval("(mu = -1.,)")
p.mu

prob = bk.BifurcationProblem(F, u0, p, bk.seval("(@lens _.mu)"), 
                            # record_from_solution = record_from_solution, 
                             J = J)
bk.newton(prob, bk.NewtonPar(verbose = True))

```

I still get

```python
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
Cell In[27], line 2
      1 # strange error. I passed the jacobian J to prob so that ForwardDiff is not used
----> 2 bk.newton(prob, bk.NewtonPar(verbose = True))

File ~/.julia/packages/PythonCall/S5MOg/src/JlWrap/any.jl:223, in __call__ (self, *args, **kwargs)
    221 return ValueBase. __dir__ (self) + self._jl_callmethod($(pyjl_methodnum(pyjlany_dir)))
    222 def __call__ (self, *args, **kwargs):
--> 223 return self._jl_callmethod($(pyjl_methodnum(pyjlany_call)), args, kwargs)
    224 def __bool__ (self):
    225 return True

TypeError: 'float' object is not iterable

```
