Python Django 1.5管理命令-IOError:[Errno 10]-无子进程
在过去的12个月里,我一直在从外部应用程序执行一个特定的管理命令。我最近升级到Django 1.5,出于某种原因,它现在抛出:Python Django 1.5管理命令-IOError:[Errno 10]-无子进程,python,django,Python,Django,在过去的12个月里,我一直在从外部应用程序执行一个特定的管理命令。我最近升级到Django 1.5,出于某种原因,它现在抛出: IOError: [Errno 10] No child processes 以下是管理命令: class Command(BaseCommand): args = '<camera_id camera_id ...>' help = 'Checks the alerts table once motion is detected'
IOError: [Errno 10] No child processes
以下是管理命令:
class Command(BaseCommand):
args = '<camera_id camera_id ...>'
help = 'Checks the alerts table once motion is detected'
def handle(self, *args, **options):
for id in args:
try:
camera = IpCamera.objects.get(pk=id)
#add log
ipcl = IpCameraLog(ipCamera=camera, type='started').save()
#check alerts
except IpCamera.DoesNotExist:
raise CommandError("Camera %s does not exist" % id)
class命令(BaseCommand):
args=''
help='检测到运动后检查警报表'
def句柄(自身、*参数、**选项):
对于参数中的id:
尝试:
camera=IpCamera.objects.get(pk=id)
#添加日志
ipcl=IpCameraLog(ipCamera=camera,type='started').save()
#检查警报
除IpCamera.DoesNotExist外:
raise命令错误(“摄像机%s不存在”%id)
有人知道这是什么原因吗
非常感谢。我认为在django 1.5中,您应该将arg base命令更改为NoArgsCommand
retry it like this:
from django.core.management.base import NoArgsCommand
class Command(NoArgsCommand):
# whatever here
这对我来说很有用。好的,请确保将init.py文件添加到包含class命令的文件所在的目录中,让django知道python包管理命令在调用它的外部应用程序外部运行良好,只有在应用程序内部调用时才会失败:(