Skip to content
This repository has been archived by the owner on Feb 29, 2024. It is now read-only.

fix the bug [Error opening file]:The codes in labelImg.py only take '… #815

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
7 changes: 6 additions & 1 deletion labelImg.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

from functools import partial
from collections import defaultdict

import imghdr
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is it built-in library? available for python 2 and 3+?

try:
from PyQt5.QtGui import *
from PyQt5.QtCore import *
Expand Down Expand Up @@ -1091,6 +1091,11 @@ def load_file(self, file_path=None):
image = self.image_data
else:
image = QImage.fromData(self.image_data)
# neglect images type
if image.isNull():
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if we have this, we don't need line:1099 to 1101

image = QImage(unicode_file_path, imghdr.what(unicode_file_path))
self.image_data = image

if image.isNull():
self.error_message(u'Error opening file',
u"<p>Make sure <i>%s</i> is a valid image file." % unicode_file_path)
Expand Down