labelImg icon indicating copy to clipboard operation
labelImg copied to clipboard

Unable to open previously saved .xml file

Open zoehako opened this issue 5 years ago • 3 comments

  • **OS: Mac
  • **PyQt version: 5.15.1
  • Python 3.8.6 Homebrew

Python crashes and this error appears when i "Open Dir > .xml file"

Traceback (most recent call last): File "labelimg.py", line 1367, in openFile self.loadFile(filename) File "labelimg.py", line 1065, in loadFile self.lineColor = QColor(*self.labelFile.lineColor) AttributeError: 'LabelFile' object has no attribute 'lineColor' zsh: abort python labelimg.py

zoehako avatar Oct 24 '20 12:10 zoehako

Also having this issue when opening an annotation directly. #341 and #210 did not work for me either.

I opened up a debugger and the initialization call to labelFile does not do anything with the filename, so it's obvious why there's no lineColor attribute or imageData. I'm guessing this workflow hasn't been exercised recently, and most just open a directory?

Opening a directory doesn't seem to work in my case either, it reports no errors and displays nothing, though perhaps that belongs in another ticket. My pascal labels are by themselves, pointing to the images via the standard pascal path parameter.

EpochalEngineer avatar Mar 24 '21 21:03 EpochalEngineer

see the script to change the file names in the XML files.link

DongChen06 avatar May 18 '21 01:05 DongChen06

Band-aid solution:

self.line_color = QColor(*self.label_file.lineColor) if hasattr(self.label_file, "lineColor") else DEFAULT_LINE_COLOR
self.fill_color = QColor(*self.label_file.fillColor) if hasattr(self.label_file, "fillColor") else DEFAULT_FILL_COLOR

…but yeah [still TODO:] need to cycle through the different colours and map them properly I think.

SamuelMarks avatar May 30 '22 20:05 SamuelMarks