desktopcouch Value error cannot covert float Nan to integer

Bug #886159 reported by fishears on 2011-11-04
This bug affects 5 people
Affects Status Importance Assigned to Milestone
desktopcouch (Ubuntu)

Bug Description

When I run this:
jb@jb-K7S41:~$ /usr/lib/desktopcouch/desktopcouch-service

I get the following output:
Traceback (most recent call last):
  File "/usr/lib/desktopcouch/desktopcouch-service", line 41, in <module>
    from desktopcouch.service import DesktopcouchService
  File "/usr/lib/pymodules/python2.7/desktopcouch/", line 9, in <module>
    from desktopcouch.application.service import *
  File "/usr/lib/pymodules/python2.7/desktopcouch/application/", line 44, in <module>
    from desktopcouch.application import local_files
  File "/usr/lib/pymodules/python2.7/desktopcouch/application/", line 297, in <module>
  File "/usr/lib/pymodules/python2.7/desktopcouch/application/", line 226, in __init__
    self.configuration = _Configuration(self)
  File "/usr/lib/pymodules/python2.7/desktopcouch/application/", line 128, in __init__
  File "/usr/lib/pymodules/python2.7/desktopcouch/application/platform/linux/", line 68, in get_oauth_data
    consumer_key = self.make_random_string(10)
  File "/usr/lib/pymodules/python2.7/desktopcouch/application/", line 26, in make_random_string
    return ''.join([entropy.choice(string.letters) for _ in range(count)])
  File "/usr/lib/python2.7/", line 274, in choice
    return seq[int(self.random() * len(seq))] # raises IndexError if seq is empty
ValueError: cannot convert float NaN to integer

This last line is the same error I get in red on the Services tab of the UbuntuOne Control Panel.
(fresh install)

ProblemType: Bug
DistroRelease: Ubuntu 11.10
Package: desktopcouch 1.0.8-0ubuntu1
ProcVersionSignature: Ubuntu 3.0.0-13.22-generic 3.0.6
Uname: Linux 3.0.0-13-generic i686
NonfreeKernelModules: nvidia
ApportVersion: 1.23-0ubuntu4
Architecture: i386
Date: Fri Nov 4 14:49:25 2011
InstallationMedia: Ubuntu 11.10 "Oneiric Ocelot" - Release i386 (20111012)
PackageArchitecture: all
SourcePackage: desktopcouch
UpgradeStatus: No upgrade log present (probably fresh install)

fishears (johnnyp-ntlworld) wrote :
Launchpad Janitor (janitor) wrote :

Status changed to 'Confirmed' because the bug affects multiple users.

Changed in desktopcouch (Ubuntu):
status: New → Confirmed
vtec (vitekcvachoucek) wrote :

I have made an intensive investigation into this one. I am java developer not a python guy but still I think you would consider my findings interesting:

Looks like it is a problem with the state of python bullt-in time module at the moment of the failure.

The problem stems from fact that the very first invocation of time.time() invocation yields NaN. I have tried to investigate the time method and time module but both dir() and help() would work just fine and produce believable results. Then I noted the traceback of the failure is not a full length so I added explicit traceback.print_stack() call nearby - AND THE DAMMED THING JUST STARTED TO WORK!!!!!!!!!!!!!!!!!

The traceback.print_stack() must internally manipulate the python modules loaded and make some change to it. There are some interesting constructs on the stack - e.g. yield based iterator or some native code - might this have something with the problem? I have run into similar problem

This is the modified /usr/share/pyshared/desktopcouch/application/ save_to_file method starting at line 157

    def save_to_file(self, file_name):
        """Save to file."""
        container = os.path.split(file_name)[0]
        import traceback, sys, time
        """ ----------------------------------
        ---------------------------------- """)
                             Time %s
        --------------------------------------- """ % time.time)
        fd, temp_file_name = tempfile.mkstemp(dir=container)
        f = os.fdopen(fd, "w")
        os.rename(temp_file_name, file_name)

Is there some linux & python guy willing to help me to investigate it further and come to reasonable conclusion?

Gregory P Smith (gpshead) wrote :

FYI - I've filed to track this as well from the Python side.

Gregory P Smith (gpshead) wrote :

As noted in the python issue, the problem in my case turned out to be bad hardware. I suspect the same of the initial reporter of this bug.

To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.