Hi again,

I got this error:

======================================
  File "C:\Program Files\wamp\www\Demexp\python\login.py", line 335, in
validate_new_response

s.add_response(cookie,this_question[0]['q_id'],new_response.encode('utf8'),new_response_link.encode('utf8'))

  File "C:\Program Files\Python25\Lib\xmlrpclib.py", line 1147, in __call__
    return self.__send(self.__name, args)

  File "C:\Program Files\Python25\Lib\xmlrpclib.py", line 1437, in
__request
    verbose=self.__verbose

  File "C:\Program Files\Python25\Lib\xmlrpclib.py", line 1201, in request
    return self._parse_response(h.getfile(), sock)

  File "C:\Program Files\Python25\Lib\xmlrpclib.py", line 1340, in
_parse_response
    return u.close()

  File "C:\Program Files\Python25\Lib\xmlrpclib.py", line 787, in close
    raise Fault(**self._stack[0])

Fault: <Fault 1: 'exceptions.Exception:method "add_response" is not
supported'>
========================================

and the same error for new_question:

Fault: <Fault 1: 'exceptions.Exception:method "new_question" is not
supported'>

I am using the demo/demo account.

        Lyu















David MENTRE a écrit :
Hello Lyu,

2008/3/11, Lyu Abe <[EMAIL PROTECTED]>:
        this_question = s.question_info(cookie, index, 1)
        marshalled_qu = marshal.dumps(this_question[0]['q_id'])
        marshalled_resp = marshal.dumps(new_response)
        s.add_response(cookie, marshalled_qu,marshalled_resp,"")

Well, I don't really understand why you would need such marshal calls.

If you look at the code of the XML RPC proxy, you see for example this
code to add a new response (line 157):

    def add_response(self, cookie, question_id, response_desc, response_link):
        ret = self.onc.add_response(cookie, question_id,
                                    response_desc.encode('utf_8'),
                                    response_link.encode('utf_8'))
        if ret != DemexpRpc.const.rt_ok:
            raise RpcError(ret)
        return ret

"cookie" is the cookie you got from login().

"question_id" is a Python integer.

"response_desc" and "response_link" are two Python strings.

When you use ONC RPC calls, you can use regular Python simple types as
arguments. Where are those marshal calls coming from?

You'll find other examples of Python code to call the demexp server in
the source code of pydemexp (http://thomas.enix.org/pub/pydemexp/), in
files "add-question.py" and "list-question.py".

If you are able to get your new response as a regular Python string,
you should be able to add it to the server pretty easily.

I hope this helps,
Yours,
d.




_______________________________________________
Demexp-dev mailing list
Demexp-dev@nongnu.org
http://lists.nongnu.org/mailman/listinfo/demexp-dev

Répondre à