title: Labelimg crashes when attempting to export YOLO training samples
body: <p>I'm pretty new to Python and labeling data for deep learning. I have installed Labelimg program in order to label a custom dataset, but it keeps crashing when I create YOLO training samples. Each time I open the program and specify the image directory, I can browse through the images, but when I create my bounding boxes and try to click on the &quot;next image&quot; button, it crashes with an error message.</p>
  <p>As a note, I followed <a href="https://medium.com/@sanghuynh_73086/how-to-install-labelimg-in-windows-with-anaconda-c659b27f0f" rel="nofollow noreferrer">this</a> tutorial to install Labelimg.</p>
  <p>Here is how I create the error:</p>
  <ol>
  <li>Open Anaconda Prompt</li>
  <li>Activate the previously-created labelimg environment in conda</li>
  </ol>
  <p><code>conda activate labelimg</code></p>
  <ol start="3">
  <li>Specify location of unzipped labelimg folder</li>
  </ol>
  <p><code>cd D:\labelimg</code></p>
  <ol start="4">
  <li>Open python script, followed by location of image directory, previously-created text file with the label name (weed), and previously-created text file with the name of the class in it (weed):</li>
  </ol>
  <p><code>python labelimg.py D:\photo_directory D:\label.txt D\:classes.txt</code></p>
  <p>The program then opens, displaying this:</p>
  <p><a href="https://i.stack.imgur.com/sn67W.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/sn67W.jpg" alt="enter image description here" /></a></p>
  <p>Notice that I am trying to export samples as YOLO training samples. The name of the picture is &quot;weed0&quot;. Whenever I create my samples and click the &quot;Next Image&quot; button, the program crashes with this error:</p>
  <pre><code>Traceback (most recent call last):
    File &quot;labelimg.py&quot;, line 1299, in openNextImg
      self.saveFile()
    File &quot;labelimg.py&quot;, line 1339, in saveFile
      self._saveFile(savedPath)
    File &quot;labelimg.py&quot;, line 1371, in _saveFile
      if annotationFilePath and self.saveLabels(annotationFilePath):
    File &quot;labelimg.py&quot;, line 837, in saveLabels
      self.lineColor.getRgb(), self.fillColor.getRgb())
    File &quot;D:\labelimg\libs\labelFile.py&quot;, line 89, in saveYoloFormat
      writer.save(targetFile=filename, classList=classList)
    File &quot;D:\labelimg\libs\yolo_io.py&quot;, line 64, in save
      out_file = codecs.open(targetFile, 'w', encoding=ENCODE_METHOD)
    File &quot;D:\anaconda3\envs\labelimg\lib\codecs.py&quot;, line 898, in open
      file = builtins.open(filename, mode, buffering)
  FileNotFoundError: [Errno 2] No such file or directory: 'D:\\weed0.txt'
  </code></pre>
  <p>What can I do to ensure that the program doesn't crash when exporting YOLO training samples? I have done everything but reinstall the program, which doesn't make sense to me because I just downloaded it.</p>