[Baypiggies] scientific notation: string to int

Bryce Verdier bryceverdier at gmail.com
Thu Dec 9 23:58:06 CET 2010


I figured it out & I'll fess up to it, it was a total ID-10-T error on 
my part.

first list of the file was:

Vol UUID, Vol Name, Commercial Timestamp, Commercial Max Space Used, Commercial Bytes Written, Commercial Bytes Read, Zetta Timestamp, Zetta Max Space Used, Zetta Bytes Written, Zetta Bytes Read, Date: Dec  2 2010


I feel so sheepish... oh well, I doubt I'll make this mistake again.

Bryce



On 12/09/2010 02:54 PM, Jeff Sheldon wrote:
> 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
> 20,15228831373,80966857300,
>
>
> 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) ;)
> #!/usr/bin/python3
>
> 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")
>           parser.print_help()
>           sys.exit(1)
>
>       file1_clients = read_file(options.first)
>       file2_clients = read_file(options.second)
>
>       for x,v in file1_clients.items():
>           file1_class_clients.append(client(x,v))
>
>       for x,v in file2_clients.items():
>           file2_class_clients.append(client(x,v))
>
>       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:
> http://mail.python.org/mailman/listinfo/baypiggies
>
>
> 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