KeyError: 'language' in 08-sort.py example

27 views
Skip to first unread message

ishafizan.ishak

unread,
Feb 14, 2012, 11:34:10 PM2/14/12
to Pattern
hi,

ran through the 08-sort.py example file and getting this error

File "D:\Python27\lib\site-packages\pattern\web\__init__.py", line
1560, in sort
service = SERVICES.get(service, SearchEngine)(license,
language=kwargs.pop("language"))
KeyError: 'language'

appreciate some help. tx

Tom De Smedt

unread,
Feb 21, 2012, 6:04:30 PM2/21/12
to Pattern
It's a bug, not all services (e.g., Google, Yahoo) have a language
parameter. This is fixed in the new release (2.3, should be online by
the end of the week) along with updated examples.

Best,
Tom

Ishafizan Ishak

unread,
Feb 21, 2012, 8:29:02 PM2/21/12
to pattern-f...@googlegroups.com
that's great news. thank u for replying

current work that i'm doing
- hv been mining twitter and facebook status, vid/pic captions and links of the Malaysian politicians. The general elections is coming soon
- compared Bing/Google translation, Google is better. Used bing to detect language and used google (not V2) to translate. so far, it's ok. just having a nightmare dealing with unicodeEcode errors
- thinking of using  http://www.highcharts.com/  (with php) for graphical representation. data are already inside a database(mysql)

great work Tom. can't wait for v2.3 and see the changes :)

best regards
is
p/s: i've just learned the languages (python, php) 2 weeks ago. Your code made it easy to learn what was going on ;)

Tom De Smedt

unread,
Feb 25, 2012, 5:10:05 PM2/25/12
to Pattern
Thanks Ishafizan. If you are looking for good Python tutorials, try:
http://learnpythonthehardway.org/

Despite its name it is not hard to follow.
Also if you have useful tips on how to handle Malaysian + unicode this
kind of information is always welcome.

Best,
Tom

On Feb 22, 2:29 am, Ishafizan Ishak <ishafi...@gmail.com> wrote:
> that's great news. thank u for replying
>
> current work that i'm doing
> - hv been mining twitter and facebook status, vid/pic captions and links of
> the Malaysian politicians. The general elections is coming soon
> - compared Bing/Google translation, Google is better. Used bing to detect
> language and used google (not V2) to translate. so far, it's ok. just
> having a nightmare dealing with unicodeEcode errors
> - thinking of using  http://www.highcharts.com/ (with php) for graphical
> representation. data are already inside a database(mysql)
>
> great work Tom. can't wait for v2.3 and see the changes :)
>
> best regards
> is
> p/s: i've just learned the languages (python, php) 2 weeks ago. Your code
> made it easy to learn what was going on ;)
>
Reply all
Reply to author
Forward
0 new messages