You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@couchdb.apache.org by Ben Hunter <bj...@gmail.com> on 2011/09/01 00:29:50 UTC

Server Error 500 unknown query language, python

I am still quite new in learning CouchDB and have come to a complete
standstill due to this server error.

I am merely running through some of the exercises in 'Mining the Social
Web'. All the programs that store data to CouchDB work fine, but when the
couchdb module is used to create a view, it throws 'Server error 500 unknown
query language python'. The same program will complete if I specify
'language = 'javascript'' within the python ViewDefinition function, but it
returns a view with proper headers and no data.

Also, the test suite runs fine except for the 'Attachments' test. This fails
in Firefox and doesn't finish in Chromium.

I am on a new install of Ubuntu 11.04, using Couchdb 1.0.1. If this is not
enough information please let me know.

Thanks.

Re: Server Error 500 unknown query language, python

Posted by Jens Alfke <je...@couchbase.com>.
On Aug 31, 2011, at 4:10 PM, Ben Hunter wrote:

> At any rate, shortly after posting I found this post from last year:
> https://mail-archives.apache.org/mod_mbox/couchdb-user/201007.mbox/%3CAANLkTimrA0xsGeqn-HnQoOUONp6LQ_ggp4ccX87Y87DK@mail.gmail.com%3E
> 
> that advises I pop this in the local.ini:
> [query_servers]
> python = /usr/local/bin/couchpy

Sounds like there is a package called “couchpy” that you need to install to make that work.

—Jens


Re: Server Error 500 unknown query language, python

Posted by Robert Newson <rn...@apache.org>.
CouchDB can support views in any language but only ships with a
Javascript view server enabled by default. As noted, you can also
enable Erlang views (though I urge caution, it has no sandbox, so a
map function may call file:delete(Path), etc).

There is at least one Python view server out there but it is
additional software you need to install and configure.

B.

On 1 September 2011 00:10, Ben Hunter <bj...@gmail.com> wrote:
> Thanks for getting back.
>
> I have to assume the code's been tested pretty rigorously, as it's straight
> from an O'Reilly book. I know that doesn't mean the code is perfect, but
> surely they wouldn't say CouchDB will do something it can't. Or would it?
>
> At any rate, shortly after posting I found this post from last year:
> https://mail-archives.apache.org/mod_mbox/couchdb-user/201007.mbox/%3CAANLkTimrA0xsGeqn-HnQoOUONp6LQ_ggp4ccX87Y87DK@mail.gmail.com%3E
>
> that advises I pop this in the local.ini:
> [query_servers]
> python = /usr/local/bin/couchpy
>
> I'll try it when I get home.
>
> On Wed, Aug 31, 2011 at 4:04 PM, Jens Alfke <je...@couchbase.com> wrote:
>
>>
>> On Aug 31, 2011, at 3:29 PM, Ben Hunter wrote:
>>
>> I am merely running through some of the exercises in 'Mining the Social
>> Web'. All the programs that store data to CouchDB work fine, but when the
>> couchdb module is used to create a view, it throws 'Server error 500
>> unknown
>> query language python’.
>>
>> As far as I know, CouchDB doesn’t support writing view functions in Python,
>> only JavaScript and Erlang. Unless there’s an external view server that
>> implements this; but that’s not a standard part of CouchDB, rather something
>> extra you’d have to install. Maybe double-check the installation/setup
>> instructions in the book?
>>
>> —Jens
>>
>>
>

Re: Server Error 500 unknown query language, python

Posted by Ben Hunter <bj...@gmail.com>.
Thanks for getting back.

I have to assume the code's been tested pretty rigorously, as it's straight
from an O'Reilly book. I know that doesn't mean the code is perfect, but
surely they wouldn't say CouchDB will do something it can't. Or would it?

At any rate, shortly after posting I found this post from last year:
https://mail-archives.apache.org/mod_mbox/couchdb-user/201007.mbox/%3CAANLkTimrA0xsGeqn-HnQoOUONp6LQ_ggp4ccX87Y87DK@mail.gmail.com%3E

that advises I pop this in the local.ini:
[query_servers]
python = /usr/local/bin/couchpy

I'll try it when I get home.

On Wed, Aug 31, 2011 at 4:04 PM, Jens Alfke <je...@couchbase.com> wrote:

>
> On Aug 31, 2011, at 3:29 PM, Ben Hunter wrote:
>
> I am merely running through some of the exercises in 'Mining the Social
> Web'. All the programs that store data to CouchDB work fine, but when the
> couchdb module is used to create a view, it throws 'Server error 500
> unknown
> query language python’.
>
> As far as I know, CouchDB doesn’t support writing view functions in Python,
> only JavaScript and Erlang. Unless there’s an external view server that
> implements this; but that’s not a standard part of CouchDB, rather something
> extra you’d have to install. Maybe double-check the installation/setup
> instructions in the book?
>
> —Jens
>
>

Re: Server Error 500 unknown query language, python

Posted by Jens Alfke <je...@couchbase.com>.
On Aug 31, 2011, at 3:29 PM, Ben Hunter wrote:

I am merely running through some of the exercises in 'Mining the Social
Web'. All the programs that store data to CouchDB work fine, but when the
couchdb module is used to create a view, it throws 'Server error 500 unknown
query language python’.

As far as I know, CouchDB doesn’t support writing view functions in Python, only JavaScript and Erlang. Unless there’s an external view server that implements this; but that’s not a standard part of CouchDB, rather something extra you’d have to install. Maybe double-check the installation/setup instructions in the book?

—Jens


Re: Server Error 500 unknown query language, python

Posted by Dave Cottlehuber <da...@muse.net.nz>.
On 1 September 2011 10:29, Ben Hunter <bj...@gmail.com> wrote:
> I am still quite new in learning CouchDB and have come to a complete
> standstill due to this server error.
>
> I am merely running through some of the exercises in 'Mining the Social
> Web'. All the programs that store data to CouchDB work fine, but when the
> couchdb module is used to create a view, it throws 'Server error 500 unknown
> query language python'. The same program will complete if I specify
> 'language = 'javascript'' within the python ViewDefinition function, but it
> returns a view with proper headers and no data.
>
> Also, the test suite runs fine except for the 'Attachments' test. This fails
> in Firefox and doesn't finish in Chromium.
>
> I am on a new install of Ubuntu 11.04, using Couchdb 1.0.1. If this is not
> enough information please let me know.
>
> Thanks.
>

Hi Ben

I tried this a while back using perl so same principles should apply.

First step is confirming a basic script runs under sudo -s -u couchdb
with interpreter, permissions & modules found correctly.
Then check your view server piping in basic tests over stdin/stdout
referring to http://wiki.apache.org/couchdb/View_server

I'm sure your python is better than mine; the most common hurdle is
not having permissions set up for the couchdb user to run python
interpreter & your script, or missing modules such as JSON
encoder/decoders.

A+
Dave