75 | | while True : |
76 | | header = self.infile.read(HEADERSIZE) |
77 | | if not header : |
78 | | break |
79 | | if (len(header) != HEADERSIZE) or (header[0] != "$") : |
80 | | # Invalid header or no Frame Sync byte. |
81 | | raise pdlparser.PDLParserError, "This file doesn't seem to be valid Hewlett-Packard LIDIL datas." |
82 | | try : |
| 75 | try : |
| 76 | while True : |
| 77 | header = self.infile.read(HEADERSIZE) |
| 78 | if not header : |
| 79 | break |
| 80 | if (len(header) != HEADERSIZE) or (header[0] != "$") : |
| 81 | # Invalid header or no Frame Sync byte. |
| 82 | raise pdlparser.PDLParserError, "This file doesn't seem to be valid Hewlett-Packard LIDIL datas." |
90 | | except struct.error : |
91 | | raise pdlparser.PDLParserError, "This file doesn't seem to be valid Hewlett-Packard LIDIL datas." |
92 | | if packettype == PACKET_TYPE_COMMAND : |
93 | | if commandnumber == LDL_LOAD_PAGE : |
94 | | loadpage += 1 |
95 | | elif commandnumber == LDL_EJECT_PAGE : |
96 | | ejectpage += 1 |
97 | | self.infile.seek(cmdlength + datalength - len(header), 1) # relative seek |
| 90 | if packettype == PACKET_TYPE_COMMAND : |
| 91 | if commandnumber == LDL_LOAD_PAGE : |
| 92 | loadpage += 1 |
| 93 | elif commandnumber == LDL_EJECT_PAGE : |
| 94 | ejectpage += 1 |
| 95 | self.infile.seek(cmdlength + datalength - len(header), 1) # relative seek |
| 96 | except struct.error : |
| 97 | raise pdlparser.PDLParserError, "This file doesn't seem to be valid Hewlett-Packard LIDIL datas." |