gpt4 book ai didi

python - DjangoQ 运行 manage.py qcluster 导致 PermissionError : [WinError5] Access is denied

转载 作者:行者123 更新时间:2023-12-03 21:30:39 26 4
gpt4 key购买 nike

我最近刚开始使用 Django 进行 Web 应用程序开发,现在使用 Django-Q 进行异步任务。

我关注了 this tutorial直到第 13 张幻灯片。不幸的是,当我尝试运行 python manage.py qcluster 时我收到这些错误消息:

(djangoq_tut) D:\Code\Python\DjangoQ_Tutorial\djangoq_demo>python manage.py qcluster
Traceback (most recent call last):
File "manage.py", line 10, in <module>
execute_from_command_line(sys.argv)
File "D:\Code\Python\DjangoQ_Tutorial\djangoq_tut\lib\site-packages\django\core\management\__init__.py", line 350, in execute_from_command_line
utility.execute()
File "D:\Code\Python\DjangoQ_Tutorial\djangoq_tut\lib\site-packages\django\core\management\__init__.py", line 342, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "D:\Code\Python\DjangoQ_Tutorial\djangoq_tut\lib\site-packages\django\core\management\base.py", line 348, in run_from_argv
self.execute(*args, **cmd_options)
File "D:\Code\Python\DjangoQ_Tutorial\djangoq_tut\lib\site-packages\django\core\management\base.py", line 399, in execute
output = self.handle(*args, **options)
File "D:\Code\Python\DjangoQ_Tutorial\djangoq_tut\lib\site-packages\django_q\management\commands\qcluster.py", line 22, in handle
q.start()
File "D:\Code\Python\DjangoQ_Tutorial\djangoq_tut\lib\site-packages\django_q\cluster.py", line 57, in start
self.sentinel.start()
File "c:\program files (x86)\python35-32\Lib\multiprocessing\process.py", line 105, in start
self._popen = self._Popen(self)
File "c:\program files (x86)\python35-32\Lib\multiprocessing\context.py", line 212, in _Popen
return _default_context.get_context().Process._Popen(process_obj)
File "c:\program files (x86)\python35-32\Lib\multiprocessing\context.py", line 313, in _Popen
return Popen(process_obj)
File "c:\program files (x86)\python35-32\Lib\multiprocessing\popen_spawn_win32.py", line 66, in __init__
reduction.dump(process_obj, to_child)
File "c:\program files (x86)\python35-32\Lib\multiprocessing\reduction.py", line 59, in dump
ForkingPickler(file, protocol).dump(obj)
TypeError: can't pickle _thread.lock objects

(djangoq_tut) D:\Code\Python\DjangoQ_Tutorial\djangoq_demo>Traceback (most recent call last):
File "<string>", line 1, in <module>
File "c:\program files (x86)\python35-32\Lib\multiprocessing\spawn.py", line 100, in spawn_main
new_handle = steal_handle(parent_pid, pipe_handle)
File "c:\program files (x86)\python35-32\Lib\multiprocessing\reduction.py", line 86, in steal_handle
_winapi.DUPLICATE_SAME_ACCESS | _winapi.DUPLICATE_CLOSE_SOURCE)
PermissionError: [WinError 5] Access is denied

我正在使用具有以下要求的 Windows 7 机器和 Python 3.5.1(32 位):
appdirs==1.4.3
arrow==0.10.0
blessed==1.14.1
Django==1.9
django-picklefield==0.3.2
django-q==0.7.18
future==0.16.0
packaging==16.8
pyparsing==2.2.0
python-dateutil==2.6.0
six==1.10.0
wcwidth==0.1.7

我尝试查找错误的来源,在我看来,它可能与 Django 或 Django-Q 不完全相关。除此之外,我真的不明白这意味着什么。

还尝试使用 Python 2.7.12,在 virtualenv 之外,我得到一个 TypeError: can't pickle _thread.lock objects ,我也不太明白。

任何想法如何解决这个问题?

[编辑]
在尝试了 DjangoQ 替代品 - Celery - 我能够重现这个问题:
如果使用 Celery 4.0.2 会出现同样的错误,但不会使用 Celery 3.1.25
我仍然没有想出如何解决这个问题,但决定暂时坚持使用 celery ,因为它有点工作......

最佳答案

Install the latest version with pip:

$ pip install django-q

Add django_q to INSTALLED_APPS in your projects settings.py:

INSTALLED_APPS = (
# other apps
'django_q',
)

Run Django migrations to create the database tables:

$ python manage.py migrate

Choose a message broker , configure it and install the appropriate client library.

Run Django Q cluster in order to handle tasks async:

$ python manage.py qcluster

关于python - DjangoQ 运行 manage.py qcluster 导致 PermissionError : [WinError5] Access is denied,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42948722/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com