[Baypiggies] scientific notation: string to int

Jeff Sheldon jeff.sheldon at emsense.com
Thu Dec 9 23:54:18 CET 2010

Are you able to tell us what OS you are running on?  The part of the error "could not convert string to float:" is coming from the interpreter, but the rest of the message comes from the os/c compiler.

It almost sounds like it is a hosted machine and some system limit has been reached.  It is certainly an interesting error message!

- Jeff

 -----Original Message-----
From: baypiggies-bounces+jeff.sheldon=emsense.com at python.org [mailto:baypiggies-bounces+jeff.sheldon=emsense.com at python.org] On Behalf Of Bryce Verdier
Sent: Thursday, December 09, 2010 2:00 PM
To: baypiggies at python.org
Subject: Re: [Baypiggies] scientific notation: string to int

Hey Keith,

The best I can do for string is the line from my original posting(client 
data, NDA, I'm sure you understand):

b1021384-6633-4756-b3e1-c36d34c1dfd2, clientname_001,Thu Dec  2 00:00:00
UTC 2010,2.96116E+11,0,0, Thu Dec  2 00:00:00 UTC 2010,577078067

I will say that in the file there are 135 lines in the files. So it's 
not like there is a lot data to deal with. I wonder if I should move 
back to 2.7.

the code is still being worked on, so don't laugh to hard (constructive 
critisims are welcomed though) ;)

import sys
import re
from optparse import OptionParser

class client(object):
     def __init__(self, name, size):
         self.name = name
         self.size = float(size)
         self.east_coast = bool(re.search("_E", name))
         self.trial = bool(re.search("TR_", name))
         self.demo = bool(re.search("_Demo", name))
         self.zetta = bool(re.search("zetta|Zetta", name))

     def get_size(self):
         return str(self.size)

     def get_name(self):
         return str(self.name)

def read_file(filename):
     file_data = {}

     with open(filename, 'r') as f:
         for lines in f:
             split_lines = lines.split(',')
             file_data[split_lines[1]] = split_lines[3]

     return file_data

if __name__ == "__main__":

     file1_clients = {}
     file2_clients = {}
     file1_class_clients = []
     file2_class_clients = []

     usage = "%prog [options]"
     parser = OptionParser(usage=usage)
     parser.add_option("-f", "--first", dest="first",
         help="Older file first, builds table from here.")
     parser.add_option("-s", "--second", dest="second",
         help="New file, used for calculating the difference.")

     (options,args) = parser.parse_args()

     if not options.first or not options.second:
         print("The file argument (-f) is nessacary to run this program.\n")

     file1_clients = read_file(options.first)
     file2_clients = read_file(options.second)

     for x,v in file1_clients.items():

     for x,v in file2_clients.items():

     for x in file1_class_clients:
         print(x.get_name() + ":" + x.get_size())

On 12/09/2010 01:44 PM, Keith Dart wrote:
> === On Thu, 12/09, Bryce Verdier wrote: ===
>> ValueError: could not convert string to float: Commercial Max Space
>> Used
>> This is in python 3.1.2 if that matters.
> ===
> Whoa, that's a new one. Not even Google knows about it. Can you supply
> the actual string here?
> -- Keith Dart

Baypiggies mailing list
Baypiggies at python.org
To change your subscription options or unsubscribe:

This email message is confidential and is intended only for the named recipient(s) above, and may contain information that is privileged, attorney work product or exempt from disclosure under applicable law.  The contents of this email are for discussion purposes only and shall not create a legally binding commitment or agreement of EmSense Corporation, which shall require EmSense Corporation management approval and a formal written agreement signed by both parties.  If you have received this message in error, or are not the named recipient(s), please immediately notify the sender and delete this message from your computer.   

More information about the Baypiggies mailing list