Modify

Opened 16 years ago

Closed 15 years ago

Last modified 15 years ago

#3443 closed defect (worksforme)

ticket.get() requires a float

Reported by: anonymous Owned by: Alec Thomas
Priority: normal Component: XmlRpcPlugin
Severity: normal Keywords:
Cc: Trac Release: 0.11

Description (last modified by Alec Thomas)

When I use the following pyscript with XML-RPC, I get the error

Traceback (most recent call last):
  File "<stdin>", line 1, in ?
  File "/usr/lib/python2.4/xmlrpclib.py", line 1096, in __call__
    return self.__send(self.__name, args)
  File "/usr/lib/python2.4/xmlrpclib.py", line 1383, in __request
    verbose=self.__verbose
  File "/usr/lib/python2.4/xmlrpclib.py", line 1147, in request
    return self._parse_response(h.getfile(), sock)
  File "/usr/lib/python2.4/xmlrpclib.py", line 1286, in _parse_response
    return u.close()
  File "/usr/lib/python2.4/xmlrpclib.py", line 744, in close
    raise Fault(**self._stack[0])
xmlrpclib.Fault: <Fault 2: "'a float is required' while executing 'ticket.get()'">

here is the pyscript

#! /usr/bin/env python

import xmlrpclib
import sys

if len(sys.argv)!=3:
        sys.exit("Must provide server and ticket id number.")

server=xmlrpclib.ServerProxy(sys.argv[1])
print server.ticket.get(float(sys.argv[2]))

Attachments (0)

Change History (3)

comment:1 Changed 16 years ago by Alec Thomas

Description: modified (diff)

comment:2 Changed 15 years ago by osimons

Resolution: worksforme
Status: newclosed

Tested with trac 0.11.4, latest xmlrpc from trunk, python 2.4. I cannot replicate this issue. Tried passing both int and string, and server.ticket.get() happily returns the right ticket.

I'm closing this. If the problem persists, please reopen with further details and information about all relevant software versions (trac, python, xmlrpc at least).

comment:3 Changed 15 years ago by Chris Heller

I managed to trigger this same error in an environment. After looking at the server output, I realized that the server environment had two instances of xmlrpclib installed.

One was the default one that was installed with python, and another was an .egg pulled down via easy_install. Trac was finding the .egg version. When requesting a valid ticket, the trac xmlrpc plugin throws the 'float is required' error when it calls to_xmlrpc_datetime, which in turn calls xmlrpclib.DateTime, which throws the error on the time.localtime() call.

What's strange is that both versions of xmlrpclib are 1.0.1. I didn't pursue the underlying error though; getting rid of the unwanted .egg solved the problem.

I don't recall what I installed that pulled down the extra copy of xmlrpclib though.

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain Alec Thomas.
The resolution will be deleted. Next status will be 'reopened'.

Add Comment


E-mail address and name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.