Modify

Opened 6 years ago

Closed 5 years ago

Last modified 5 years ago

#3443 closed defect (worksforme)

ticket.get() requires a float

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

Description (last modified by athomas)

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 6 years ago by athomas

  • Description modified (diff)

comment:2 Changed 5 years ago by osimons

  • Resolution set to worksforme
  • Status changed from new to closed

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 5 years ago by chrisheller

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.

Add Comment

Modify Ticket

Action
as closed .
as The resolution will be set. Next status will be 'closed'.
to The owner will be changed from athomas. Next status will be 'closed'.
The resolution will be deleted. Next status will be 'reopened'.
Author


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

 
Note: See TracTickets for help on using tickets.