kaonashi-tyc/zi2zi

IOError: [Errno 2] No such file or directory: 'dir/0_0000.jpg'

H-xie opened this issue · 2 comments

H-xie commented

This is a SOLVED problem.

When running the preprocess command

python font2img.py --src_font=src.ttf
                   --dst_font=tgt.otf
                   --charset=CN 
                   --sample_count=1000
                   --sample_dir=dir
                   --label=0
                   --filter=1
                   --shuffle=1

An error occurred as title, which informs that the file is not exist by the code
[line 87 | font2img.py] e.save(os.path.join(sample_dir, "%d_%04d.jpg" % (label, count)))

This is not a bug of PIL(pillow). It is coursed by the command. If the sample_dir is not exits, the program will through an error rather than create the sample_dir.

In conclusion, BEFORE run the preprocess command, sample_dir should be mkdir MANUALLY.

In the options, there are a '--sample_dir=dir'. That is mean, you must mkdir a directory, which named "dir".

对的 在当前目录中先执行 mkdir dir