samkit-jain / Handwriting-Recognition

Software to recognize handwriting
Apache License 2.0
63 stars 24 forks source link

OSError: [Errno 24] Too many open files: #12

Closed hsjeevan closed 4 years ago

hsjeevan commented 4 years ago

I'm running this program on windows, and I'm encountering this issue when I run the dataset.py file.

Setting up EMNIST dataset
Downloading file from https://www.itl.nist.gov/iaui/vip/cs_links/EMNIST/gzip.zip and saving to D:\Coding\Python\Handwriting-Recognition-master\Python\download\gzip.zip
Extracting D:\Coding\Python\Handwriting-Recognition-master\Python\download\gzip.zip
Extracting D:\Coding\Python\Handwriting-Recognition-master\Python\download\gzip\emnist-balanced-train-images-idx3-ubyte.gz
Extracting D:\Coding\Python\Handwriting-Recognition-master\Python\download\gzip\emnist-balanced-train-labels-idx1-ubyte.gz
Extracting D:\Coding\Python\Handwriting-Recognition-master\Python\download\gzip\emnist-balanced-test-images-idx3-ubyte.gz
Extracting D:\Coding\Python\Handwriting-Recognition-master\Python\download\gzip\emnist-balanced-test-labels-idx1-ubyte.gz
Converting D:\Coding\Python\Handwriting-Recognition-master\Python\download\gzip\emnist-balanced-train-images-idx3-ubyte to image files
Traceback (most recent call last):
  File "D:/Coding/Python/Handwriting-Recognition-master/Python/dataset.py", line 221, in <module>
    creator.create()
  File "D:/Coding/Python/Handwriting-Recognition-master/Python/dataset.py", line 95, in create
    label_mapping=label_mapping
  File "D:/Coding/Python/Handwriting-Recognition-master/Python/dataset.py", line 177, in idx_to_image
    image_dest = tempfile.mkstemp(dir=label_folder, suffix='.png')[1]
  File "C:\Users\hsjee\AppData\Local\Programs\Python\Python37\lib\tempfile.py", line 340, in mkstemp
    return _mkstemp_inner(dir, prefix, suffix, flags, output_type)
  File "C:\Users\hsjee\AppData\Local\Programs\Python\Python37\lib\tempfile.py", line 258, in _mkstemp_inner
    fd = _os.open(file, flags, 0o600)
OSError: [Errno 24] Too many open files: 'D:\\Coding\\Python\\Handwriting-Recognition-master\\Python\\data\\n\\tmp9gd3zyow.png'

Process finished with exit code 1
samkit-jain commented 4 years ago

Hi @hsjeevan I've pushed a fix at https://github.com/samkit-jain/Handwriting-Recognition/tree/fix/too-many-files-open Can you try using this branch and verify whether the issue has been resolved or not?

hsjeevan commented 4 years ago

Thanks, @samkit-jain!

'os' import was missing. Otherwise worked fine. Thanks again :)

samkit-jain commented 4 years ago

No problem @hsjeevan Thanks for trying out the project!