Guys,

 

I've got what seems to me to be a totally illogical math issue here which I
can't figure out. Take a look at the following code:

 

        self.__logger.info("%i / %i" % (bytes_transferred,
self.__sessions[path].total_bytes))

        percentage = bytes_transferred / self.__sessions[path].total_bytes *
100

        self.__logger.info("%i" % percentage)

 

Seems fairly straight forward, you would think. It takes two values and
calculates the percentage of one from the other, however, percentage always
comes back as '0' for some reason, look at this log output.

 

2008-07-21 08:39:05,465 manager.py 78 INFO     290112 / 442435

2008-07-21 08:39:05,466 manager.py 80 INFO     0

 

Any suggestions as to why this might be the case? I'm sure it's something
dumb but I can't spot it.

 

Robert

--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to