labelImg icon indicating copy to clipboard operation
labelImg copied to clipboard

Not find:/data/predefined_classes.txt (optional).TypeError: expected str, bytes or os.PathLike object, not NoneType

Open monkeycc opened this issue 3 years ago • 5 comments

  • OS: WIN11
  • PyQt version: PyQt5 5.15.6

"D:\labelImg\data\predefined_classes.txt" existence

cd  labelImg
python labelImg.py

Not find:/data/predefined_classes.txt (optional)
Traceback (most recent call last):
  File "D:\0SDXX\labelImg\labelImg.py", line 1359, in open_dir_dialog
    self.import_dir_images(target_dir_path)
  File "D:\0SDXX\labelImg\labelImg.py", line 1374, in import_dir_images
    self.open_next_image()
  File "D:\0SDXX\labelImg\labelImg.py", line 1429, in open_next_image
    self.change_save_dir_dialog()
  File "D:\0SDXX\labelImg\labelImg.py", line 1309, in change_save_dir_dialog
    self.show_bounding_box_from_annotation_file(self.file_path)
  File "D:\0SDXX\labelImg\labelImg.py", line 1182, in show_bounding_box_from_annotation_file
    basename = os.path.basename(os.path.splitext(file_path)[0])
  File "D:\anaconda3\lib\ntpath.py", line 204, in splitext
    p = os.fspath(p)
TypeError: expected str, bytes or os.PathLike object, not NoneType

monkeycc avatar Jul 19 '22 14:07 monkeycc

找到解决办法了没??

yourdaddaddadd avatar Jul 29 '22 12:07 yourdaddaddadd

I don't know what caused it

uninstall Reinstall

@yourdaddaddadd

monkeycc avatar Jul 30 '22 03:07 monkeycc

This error happens to me several times. Try to copy the classes.txt file to the folder which has the frames

ahmedibrahim0100 avatar Aug 12 '22 20:08 ahmedibrahim0100

Got a solution to this yet?

Benaia7 avatar Aug 26 '22 19:08 Benaia7

If it is the first time you annotate images inside a folder, open any image in that folder from labelimg using “open” not “open dir”, annotate it and save the annotation *.txt file. Try then to use “open dir” to begin annotations with your folder.

The same error also happens when I resume annotations on a folder after a change has happened to the classes.txt file (a change from outside labelimg). In this case, I delete the classes.txt file from the working directory and restore the original one.

ahmedibrahim0100 avatar Aug 29 '22 04:08 ahmedibrahim0100

Thanks that was very helpful

Sent from my iPhone

On 29 Aug 2022, at 06:52, ahmedibrahim0100 @.***> wrote:

 If it is the first time you annotate images inside a folder, open any image in that folder from labelimg using “open” not “open dir”, annotate it and save the annotation *.txt file. Try then to use “open dir” to begin annotations with your folder.

The same error also happens when I resume annotations on a folder after a change has happened to the classes.txt file (a change from outside labelimg). In this case, I delete the classes.txt file from the working directory and restore the original one.

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you commented.

Benaia7 avatar Oct 11 '22 08:10 Benaia7

https://github.com/heartexlabs/labelImg/issues/967#issuecomment-1359672079 I solve the problem

spped2000 avatar Dec 20 '22 16:12 spped2000