parsing tree from excel sheet

Mark Lawrence breamoreboy at yahoo.co.uk
Thu Jan 29 22:59:47 CET 2015


On 29/01/2015 21:32, alb wrote:
> Hi MRAB,
>
> MRAB <python at mrabarnett.plus.com> wrote:
> []
>>>> SyntaxError: invalid syntax
>>>> debian at debian:example$ python3 export_latex.py doctree.csv
>>>>    File "export_latex.py", line 36
>>>>      yield from child.show2()
>>>>               ^
>>>> SyntaxError: invalid syntax
>>>
>>> and I've tried with both python and python3 (see below versions).
>>>
>>> debian at debian:example$ python
>>> Python 2.6.6 (r266:84292, Dec 27 2010, 00:02:40)
>>> [GCC 4.4.5] on linux2
>>> Type "help", "copyright", "credits" or "license" for more information.
>>>>>>
>>> debian at debian:example$ python3
>>> Python 3.1.3 (r313:86834, Nov 28 2010, 11:28:10)
>>> [GCC 4.4.5] on linux2
>>> Type "help", "copyright", "credits" or "license" for more information.
>>>>>>
>>>
>>> Is it an issue related to my installation? Shall I upgrade and/or
>>> downgrade?
>>>
>> "yield from" was introduced in Python 3.3.
>>
>
> Ok, that either means I need to upgrade to 3.3 or need to modify the
> snippet to a suitable syntax that would work with other versions.
>
> Considering that upgrading is something that I'm not keen to do on my
> production system I believe I've only have one available choice.
>
> It seems I could use the generator and iterate with .next() in python
> 2.6, at least from what I found here:
> http://stackoverflow.com/questions/1756096/understanding-generators-in-python
>
> Al
>

I'd be inclined to upgrade, see here 
https://www.python.org/dev/peps/pep-0380/#formal-semantics for why :)

-- 
My fellow Pythonistas, ask not what our language can do for you, ask
what you can do for our language.

Mark Lawrence




More information about the Python-list mailing list