Problems found while packaging as binaries.Has been tested. (#855)

* Fix

Error "IndexError: list index out of range"  occurs when there is no "predefined_classes.txt".

* Fix an error when default label is null.

Error "IndexError: list index out of range"  occurs when there is no "/data/predefined_classes.txt".

* Update README.rst

ADD: Package as a separate exe file method.
This commit is contained in:
PTA00 2022-03-08 14:56:10 +08:00 committed by GitHub
parent 0f111e643a
commit 9e4a4b711e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 13 additions and 1 deletions

View File

@ -119,6 +119,15 @@ Open cmd and go to the `labelImg <#labelimg>`__ directory
python labelImg.py
python labelImg.py [IMAGE_PATH] [PRE-DEFINED CLASS FILE]
If you want to package it into a separate EXE file
.. code:: shell
Install pyinstaller and execute:
pip install pyinstaller
pyinstaller --hidden-import=pyqt5 --hidden-import=lxml -F -n "labelImg" -c labelImg.py -p ./libs -p ./
Windows + Anaconda
^^^^^^^^^^^^^^^^^^

View File

@ -109,7 +109,10 @@ class MainWindow(QMainWindow, WindowMixin):
# Load predefined classes to the list
self.load_predefined_classes(default_prefdef_class_file)
if self.label_hist:
self.default_label = self.label_hist[0]
else:
print("Not find:/data/predefined_classes.txt (optional)")
# Main widgets and related state.
self.label_dialog = LabelDialog(parent=self, list_item=self.label_hist)