Python 错误 OSError: [Errno 31] 链接太多
问题描述:
请参阅下面的错误消息,我在尝试使用 Python 的本机 os 库创建新目录时收到此错误消息.
See error message below, I get this while trying to create a new directory with Python's native os library.
...
File "files.py", line 93, in create_dir
os.makedirs(d)
File "/usr/lib/python2.7/os.py", line 150, in makedirs
makedirs(head, mode)
File "/usr/lib/python2.7/os.py", line 157, in makedirs
mkdir(name, mode)
OSError: [Errno 31] Too many links: '/var/lib/kaas/77520'
我可以看到这个目录中已经有超过 32000 个目录
I can see that there are just above 32000 directories already in this directory
$ ll | wc -l
32001
操作系统级别对可以创建的目录数量有限制吗,或者是什么导致了这里的问题?还是这是 Python 的限制?
Is there a limit on the OS level for how many directories that can be created or what is causing the issue here? Or is this a Python limitation?
我运行的是 Ubuntu 12.04.4 LTS.
I'm running Ubuntu 12.04.4 LTS.
答
32000 目录条目限制是文件系统级别的 ext3 限制.
The 32000 directory entry limit is a filesystem-level ext3 limit.