2

我正在使用 Anaconda python,我正在尝试使用官方文档运行一个简单的 Django 服务器。当我运行时python manage.py runserver出现此错误

Nuseirs-MacBook-Pro:anothertry nyassin$ python manage.py runserver
Validating models...

0 errors found
November 06, 2013 - 18:27:10
Django version 1.7.dev20131105182658, using settings 'anothertry.settings'
Starting development server at http://127.0.0.1:8000/
Quit the server with CONTROL-C.
Traceback (most recent call last):
  File "manage.py", line 10, in <module>
    execute_from_command_line(sys.argv)
  File "/Users/nyassin/django-trunk/django/core/management/__init__.py", line 416, in execute_from_command_line
    utility.execute()
  File "/Users/nyassin/django-trunk/django/core/management/__init__.py", line 408, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/Users/nyassin/django-trunk/django/core/management/base.py", line 244, in run_from_argv
    self.execute(*args, **options.__dict__)
  File "/Users/nyassin/django-trunk/django/core/management/base.py", line 291, in execute
    output = self.handle(*args, **options)
  File "/Users/nyassin/django-trunk/django/core/management/commands/runserver.py", line 76, in handle
    self.run(*args, **options)
  File "/Users/nyassin/django-trunk/django/core/management/commands/runserver.py", line 85, in run
    autoreload.main(self.inner_run, args, options)
  File "/Users/nyassin/django-trunk/django/utils/autoreload.py", line 359, in main
    reloader(wrapped_main_func, args, kwargs)
  File "/Users/nyassin/django-trunk/django/utils/autoreload.py", line 325, in python_reloader
    reloader_thread()
  File "/Users/nyassin/django-trunk/django/utils/autoreload.py", line 304, in reloader_thread
    if fn():
  File "/Users/nyassin/django-trunk/django/utils/autoreload.py", line 217, in kqueue_code_changed
    new_descriptors = set(open(filename) for filename in new_filenames)
  File "/Users/nyassin/django-trunk/django/utils/autoreload.py", line 217, in <genexpr>
    new_descriptors = set(open(filename) for filename in new_filenames)
IOError: [Errno 24] Too many open files: '//anaconda/lib/python2.7/lib-dynload/resource.so'

有什么想法可能导致这种情况吗?

4

1 回答 1

0

这是一个操作系统错误。打开文件的最大数量是有限的。尝试找到打开文件的位置并忘记关闭它们。

一次打开较少的文件描述符。

set(open(filename) for filename in new_filenames)

是错误发生的地方。

于 2013-11-06T19:33:29.390 回答