zen / open-tran

Automatically exported from code.google.com/p/open-tran
GNU General Public License v2.0
0 stars 1 forks source link

Error while access through Python API #15

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
I'm using the example showing how to make rpc calls via Python API and the
following error is occurring:

Traceback (most recent call last):
  File "/home/richizo/bin/translate.py", line 11, in <module>
    for sugg in server.suggest(sys.argv[1],lang):
  File "/usr/lib/python2.5/xmlrpclib.py", line 1147, in __call__
    return self.__send(self.__name, args)
  File "/usr/lib/python2.5/xmlrpclib.py", line 1437, in __request
    verbose=self.__verbose
  File "/usr/lib/python2.5/xmlrpclib.py", line 1201, in request
    return self._parse_response(h.getfile(), sock)
  File "/usr/lib/python2.5/xmlrpclib.py", line 1340, in _parse_response
    return u.close()
  File "/usr/lib/python2.5/xmlrpclib.py", line 787, in close
    raise Fault(**self._stack[0])
xmlrpclib.Fault: <Fault 1: 'pysqlite2.dbapi2.OperationalError:no such
table: phrases'>

My program:

#!/usr/bin/python
# -*- coding: utf-8 -*-
import sys
from xmlrpclib import ServerProxy

lang = "pt_BR"
server = ServerProxy("http://open-tran.eu/RPC2")

if __name__ == "__main__":
    if sys.argv.__len__() == 2:
        for sugg in server.suggest(sys.argv[1],lang):
            print sugg
    else:
        print "Usage: %s <words_to_translate>" % sys.argv[0]
        sys.exit(1)

    sys.exit(0)

Thanks.

Original issue reported on code.google.com by n1ghtcr4wler on 27 Jul 2008 at 4:37

GoogleCodeExporter commented 8 years ago
This issue has been resolved.  In my last update, I failed to notice that the 
service
stopped working with "pt_BR", because it was expecting "pt_br".  The API is
case-insensitive again.

Thank you for spotting this issue and giving the feedback!  Please notice that 
I am
currently considering a minor change in the API: the "name" field will probably
provide the name of the project (GNOME, KDE, etc.) and there will be an 
additional
field - "path" that will store the current value of "name" field.

Original comment by sliw...@gmail.com on 27 Jul 2008 at 5:23