Changeset 995
- Timestamp:
- 05/13/03 15:54:20 (22 years ago)
- Location:
- pykota/trunk/pykota
- Files:
-
- 2 modified
Legend:
- Unmodified
- Added
- Removed
-
pykota/trunk/pykota/accounters/external.py
r991 r995 21 21 # 22 22 # $Log$ 23 # Revision 1.2 2003/05/13 13:54:20 jalet 24 # Better handling of broken pipes 25 # 23 26 # Revision 1.1 2003/05/07 19:47:06 jalet 24 27 # v1.07 Release of the Shame is out ! … … 78 81 79 82 # launches external accounter 80 process = popen2.Popen3("%s" % self.arguments) 83 try : 84 process = popen2.Popen3("%s" % self.arguments) 81 85 82 # feed it with our data83 data = infile.read(256*1024)84 while data :85 process.tochild.write(data)86 temporary.write(data)87 data = infile.read(256*1024)88 process.tochild.close()86 # feed it with our data 87 data = infile.read(256*1024) 88 while data : 89 process.tochild.write(data) 90 temporary.write(data) 91 data = infile.read(256*1024) 92 process.tochild.close() 89 93 90 # wait for child process to exit (or die) 91 retcode = process.wait() 92 93 # check exit status 94 if os.WIFEXITED(retcode) and not os.WEXITSTATUS(retcode) : 95 # tries to extract the job size from the external accounter's 96 # standard output 97 try : 98 pagecount = int(process.fromchild.readline().strip()) 99 except (AttributeError, ValueError) : 94 # wait for child process to exit (or die) 95 retcode = process.wait() 96 97 # check exit status 98 if os.WIFEXITED(retcode) and not os.WEXITSTATUS(retcode) : 99 # tries to extract the job size from the external accounter's 100 # standard output 101 try : 102 pagecount = int(process.fromchild.readline().strip()) 103 except (AttributeError, ValueError) : 104 self.filter.logger.log_message(_("Unable to compute job size with external accounter %s") % self.arguments) 105 pagecount = 0 106 else : 100 107 self.filter.logger.log_message(_("Unable to compute job size with external accounter %s") % self.arguments) 101 108 pagecount = 0 102 else : 103 self.filter.logger.log_message(_("Unable to compute job size with external accounter %s") % self.arguments) 109 process.fromchild.close() 110 except IOError, msg : 111 msg = "%s : %s" % (self.arguments, msg) 112 self.filter.logger.log_message(_("Unable to compute job size with external accounter %s") % msg) 104 113 pagecount = 0 105 process.fromchild.close()106 114 107 115 if temporary is not None : -
pykota/trunk/pykota/version.py
r991 r995 21 21 # 22 22 23 __version__ = "1.0 7_unofficial"23 __version__ = "1.08alpha1_unofficial" 24 24 25 25 __doc__ = """PyKota : a complete Printing Quota Solution for CUPS and LPRng."""