Show
Ignore:
Timestamp:
08/22/04 16:04:47 (20 years ago)
Author:
jalet
Message:

Tries to fix problem with subprocesses outputting more datas than needed

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • pykota/trunk/pykota/accounters/software.py

    r1665 r1678  
    2222# 
    2323# $Log$ 
     24# Revision 1.8  2004/08/22 14:04:47  jalet 
     25# Tries to fix problem with subprocesses outputting more datas than needed 
     26# 
    2427# Revision 1.7  2004/08/06 13:45:51  jalet 
    2528# Fixed french translation problem. 
     
    7376        pagecount = 0 
    7477        try : 
    75             pagecount = int(child.fromchild.readline().strip()) 
    76         except (AttributeError, ValueError) : 
    77             self.filter.printInfo(_("Unable to compute job size with accounter %s") % self.arguments) 
     78            answer = child.fromchild.read() 
    7879        except (IOError, OSError), msg :     
    7980            msg = "%s : %s" % (self.arguments, msg)  
    8081            self.filter.printInfo(_("Unable to compute job size with accounter %s") % msg) 
     82        else :     
     83            lines = [l.strip() for l in answer.split("\n")] 
     84            for i in range(len(lines)) :  
     85                try : 
     86                    pagecount = int(lines[i]) 
     87                except (AttributeError, ValueError) : 
     88                    self.filter.printInfo(_("Unable to compute job size with accounter %s") % self.arguments) 
     89                    self.filter.printInfo(_("Line skipped in accounter's output. Trying again...")) 
     90                else :     
     91                    break 
    8192        child.fromchild.close() 
    8293