Hello again  :-) ,

This script is very much a work in progress, and I think only the second time I have tried classes. What I expected it to do was to at least print 'hi there' so I know its alive, then dump some status info to my log program. It does zip, executes OK but no output.

I just know you guys are going to tell me I have missed a () or . somewhere

Any help gratefully appreciated
Dave





#!/usr/bin/env python
# -*- coding: iso8859_1 -*-

"""
arch_data.py 1.0 This is the read archive data script
"""

from os import listdir
from cPickle import load
from logger import log

from config import data_dir

debug=True
class Arch_data:
def __init__(self):
self.file_names=listdir(data_dir)
self.file_names.sort()
self.file_name_ptr=0
def read_next():
"""
when executed reads next data file from data_dir extracts date,
time,julian day,sequence count & flag from the file name.
Also adds last_file flag and contents of file to the list of returned
parameters
"""
print 'hi there'
file_name=self.file_names[self.file_name_ptr]
# Ignore the archive_read.py utility script in the data dir
## if file_name=='archive_read.py':
## if debug:
## log('II','arch_data','Ignoring "archive_read.py"')
## self.file_name_ptr+=1
## read.next()
## return
# Extract info from the encoded filename :-)
file_yy=file_name[:4]
file_mm=file_name[4:6]
file_dd=file_name[6:8]
file_HH=file_name[9:11]
file_MM=file_name[11:13]
file_jj=file_name[14:17]
file_seq=file_name[18:21]
file_flag=file_name[22:24]
if debug:
log('II','arch_data','unpickling '+file_name)
pickle_file=open(data_dir+file_name,'r')
file=load(pickle_file)
pickle_file.close()
print file_yy,file_mm,file_dd,file_HH,file_MM,file_jj,file_seq,file_flag


self.file_name_ptr+=1
arch_data=Arch_data()
arch_data.read_next



_______________________________________________
Tutor maillist - [EMAIL PROTECTED]
http://mail.python.org/mailman/listinfo/tutor

Reply via email to