# iod.lambert method does not work in poliastro 0.14.0 and 0.16.3 in Windows 10 (?) [closed]

I try to reproduce the "Analyzing the Parker Solar Probe flybys" example from the page https://docs.poliastro.space/en/latest/examples/Analyzing%20the%20Parker%20Solar%20Probe%20flybys.html, but have no success. The call
v0, v1_pre = iod.lambert(Sun.k, r0, r1, tof.to(u.s))
(cell #17 in the link above) got the error "ValueError: not enough values to unpack (expected 2, got 1)".
I had tried option like the next
v0 = iod.lambert(Sun.k, r0, r1, tof.to(u.s))
and print v0. It got the message: "<generator object lambert at 0x000001BAE85380B0>".

I had tried iod.lambert, iod.izzo.lambert and iod.vallado.lambert. The last option got error "AttributeError: module 'poliastro.iod' has no attribute 'vallado' ".
Jupyter notebook and Python standalone script have the same behavior.
I had tried it with poliastro 0.14.0 and 0.16.3, I reboot Windows after poliastro 0.16.3 install, all with no success.
Python 3.8.2 64 bit.

What I do wrong?

• This belongs in Stack Overflow. Jun 24 at 19:04
• I’m voting to close this question because this is a programming question and should be posted to Stack Overflow. Jun 25 at 10:47

I tried to follow the tutorial and encountered the same error as you. Then I tried debugging and got the value in the desired format as shown in the tutorial. Here's what you should do -

1. The value returned by iod.lambert() method is a generator object which is basically an iterator. We cannot treat it as an array or list, hence indexing won't help. The first step is to convert it into a list. Also, as shown in the tutorial, it does return 2 objects of 'Quantity' type but they are within the same generator object, so we will take them in one single output -
v = iod.lambert(Sun.k, r0, r1, tof.to(u.s))
m = list(v)
m[0]

>>> (<Quantity [ 9.59933726, 11.29855172,  2.92449333] km / s>,
<Quantity [-16.98082099,  23.30752839,   9.13129077] km / s>)

1. Now to get v0 from the tutorial, simply index m like a normal array -
v0 = m[0][0]
v0

>>> [9.5993373, 11.298552, 2.9244933] km / s

v1_pre = m[0][1]
v1_pre

>>> [−16.980821, 23.307528, 9.1312908] km / s


Here's the screenshot -

Hope this helps.

• Thank You very much! All the code of the example works! Jun 24 at 17:16
• @PeterNazarenko You're welcome! Please mark the answer as accepted if it solved your query. Jun 24 at 17:22