Wikipedia icon indicating copy to clipboard operation
Wikipedia copied to clipboard

invalid syntax in wikipedia.py

Open Gurzo opened this issue 11 years ago • 1 comments

i'm working on CentOS 6.6 - Python 2.6.6 when i install wikipedia with pip or from git source, i get this error:

File "/usr/lib/python2.6/site-packages/wikipedia/init.py", line 1, in from .wikipedia import * File "/usr/lib/python2.6/site-packages/wikipedia/wikipedia.py", line 699 for lang in languages ^ SyntaxError: invalid syntax

i solved with this syntax:

a = {} for lang in languages: b = lang['code'] c = lang['*'] a[b] = c return a

instead of:

return { lang['code']: lang['*'] for lang in languages }

insert this code in wikipedia in git source and install with setup,py

Gurzo avatar Feb 01 '15 20:02 Gurzo

wikipedia 1.5.0 (https://github.com/goldsmith/Wikipedia/releases/tag/v1.5.0) requires Python 3.10+, so this Python-2-era report is obsolete. Closing.

goldsmith avatar Oct 25 '26 03:10 goldsmith