Labelimg: Latest commit causes index error on Windows

Created on 13 Oct 2020  路  1Comment  路  Source: tzutalin/labelImg

  • OS: Windows 10
  • PyQt version: 5.12.0

The latest commit (31463497c89928e7d2ea47d3e8bf5a953fdf8aeb) does not seem to be compatible with Windows file names:

Traceback (most recent call last):
  File "labelImg.py", line 1271, in openDirDialog
    self.importDirImages(targetDirPath)
  File "labelImg.py", line 1282, in importDirImages
    self.openNextImg()
  File "labelImg.py", line 1355, in openNextImg
    self.loadFile(filename)
  File "labelImg.py", line 1096, in loadFile
    self.showBoundingBoxFromAnnotationFile(filePath)
  File "labelImg.py", line 1114, in showBoundingBoxFromAnnotationFile
    filedir = filePath.split(basename)[0].split("/")[-2:-1][0]
IndexError: list index out of range

Specifically, ln 1114 in labelImg.py is: filedir = filePath.split(basename)[0].split("/")[-2:-1][0] which will always fail on Windows.

Most helpful comment

Open labelImg.py and change line 1114 to
filedir = filePath.split(basename)[0].split("\\")[-2:-1][0]

>All comments

Open labelImg.py and change line 1114 to
filedir = filePath.split(basename)[0].split("\\")[-2:-1][0]

Was this page helpful?
0 / 5 - 0 ratings

Related issues

swiss-knight picture swiss-knight  路  5Comments

javadba picture javadba  路  4Comments

austinulfers picture austinulfers  路  4Comments

JNKielmann picture JNKielmann  路  6Comments

benguyer picture benguyer  路  8Comments