Skip to content

Commit

Permalink
boxvalidator: Fix Python runtime error
Browse files Browse the repository at this point in the history
This error was reported while validating some JP2 files:

Traceback (most recent call last):
  File "/usr/local/lib/python3.2/dist-packages/jpylyzer/jpylyzer.py",
       line 631, in <module>    main()
  File "/usr/local/lib/python3.2/dist-packages/jpylyzer/jpylyzer.py",
       line 627, in main    checkFiles(args.inputRecursiveFlag, args.inputWrapperFlag, jp2In)
  File "/usr/local/lib/python3.2/dist-packages/jpylyzer/jpylyzer.py",
       line 553, in checkFiles    xmlElement = checkOneFile(path)
  File "/usr/local/lib/python3.2/dist-packages/jpylyzer/jpylyzer.py",
       line 268, in checkOneFile    "JP2", fileData).validate()  # validateJP2(fileData)
  File "/usr/local/lib/python3.2/dist-packages/jpylyzer/boxvalidator.py",
       line 99, in validate    to_call()
  File "/usr/local/lib/python3.2/dist-packages/jpylyzer/boxvalidator.py",
       line 2255, in validate_JP2    boxType, boxContents).validate()
  File "/usr/local/lib/python3.2/dist-packages/jpylyzer/boxvalidator.py",
       line 99, in validate    to_call()
  File "/usr/local/lib/python3.2/dist-packages/jpylyzer/boxvalidator.py",
       line 1240, in validate_contiguousCodestreamBox
    if qStyle == 0:
UnboundLocalError: local variable 'qStyle' referenced before assignment

Signed-off-by: Stefan Weil <sw@weilnetz.de>
  • Loading branch information
stweil committed Oct 14, 2015
1 parent 8dfd5da commit 9f9b661
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions jpylyzer/boxvalidator.py
Original file line number Diff line number Diff line change
Expand Up @@ -1235,6 +1235,8 @@ def validate_contiguousCodestreamBox(self):
lqcd = self.characteristics.findElementText('qcd/lqcd')
qStyle = self.characteristics.findElementText('qcd/qStyle')
levels = self.characteristics.findElementText('cod/levels')
else:
qStyle = -9999

# Expected lqcd as a function of qStyle and levels
if qStyle == 0:
Expand Down

0 comments on commit 9f9b661

Please # to comment.