[Zope] csv -> urllib -> zSQL

David Siedband david at calteg.org
Thu Aug 26 17:39:08 EDT 2004


I'm trying to read data from a csv on a remote machine and get it into  
MySQL.

recordEnergyReading is a zSQL in the same directory as this python  
script.

def powerData(self,REQUEST):
    import csv
    import urllib
    inFile =  
"".join(urllib.urlopen('http://www.davisenergy.com/zeh_data/ 
A042304.DAT').readlines())
    from cStringIO import StringIO
    filebody=StringIO(inFile.read())
    reader = csv.DictReader(filebody,("recdate", "recTime", "TAO",  
"TA1z", "TA2z", "TA1C", "TA2C", "INSOL", "EACz", "EFANz", "EHSEz",  
"EPV", "GASFz", "DMP", "EAC1c", "EAC2c", "EFAN1", "EFAN2", "EHSEc",  
"GASFc"))
    for row in reader:
     self.recordEnergyReading(row)

The zSQL works fine when tested on it's own.  How do I locate the  
problem?

--
David



More information about the Zope mailing list