Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No JSON object could be decoded #20

Open
SolarisYan opened this issue May 27, 2016 · 2 comments
Open

No JSON object could be decoded #20

SolarisYan opened this issue May 27, 2016 · 2 comments

Comments

@SolarisYan
Copy link

python manage.py celery worker --loglevel=info
Traceback (most recent call last):
File "manage.py", line 10, in
execute_from_command_line(sys.argv)
File "/usr/lib64/python2.7/site-packages/django/core/management/init.py", line 353, in execute_from_command_line
utility.execute()
File "/usr/lib64/python2.7/site-packages/django/core/management/init.py", line 345, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/usr/lib/python2.7/site-packages/djcelery/management/commands/celery.py", line 23, in run_from_argv
['{0[0]} {0[1]}'.format(argv)] + argv[2:],
File "/usr/lib/python2.7/site-packages/celery/bin/celery.py", line 769, in execute_from_commandline
super(CeleryCommand, self).execute_from_commandline(argv)))
File "/usr/lib/python2.7/site-packages/celery/bin/base.py", line 307, in execute_from_commandline
return self.handle_argv(self.prog_name, argv[1:])
File "/usr/lib/python2.7/site-packages/celery/bin/celery.py", line 761, in handle_argv
return self.execute(command, argv)
File "/usr/lib/python2.7/site-packages/celery/bin/celery.py", line 693, in execute
).run_from_argv(self.prog_name, argv[1:], command=argv[0])
File "/usr/lib/python2.7/site-packages/celery/bin/worker.py", line 179, in run_from_argv
return self(_args, *_options)
File "/usr/lib/python2.7/site-packages/celery/bin/base.py", line 270, in call
ret = self.run(_args, *_kwargs)
File "/usr/lib/python2.7/site-packages/celery/bin/worker.py", line 212, in run
state_db=self.node_format(state_db, hostname), **kwargs
File "/usr/lib/python2.7/site-packages/celery/worker/init.py", line 95, in init
self.app.loader.init_worker()
File "/usr/lib/python2.7/site-packages/celery/loaders/base.py", line 128, in init_worker
self.import_default_modules()
File "/usr/lib/python2.7/site-packages/djcelery/loaders.py", line 141, in import_default_modules
self.autodiscover()
File "/usr/lib/python2.7/site-packages/djcelery/loaders.py", line 144, in autodiscover
self.task_modules.update(mod.name for mod in autodiscover() or ())
File "/usr/lib/python2.7/site-packages/djcelery/loaders.py", line 179, in autodiscover
for app in settings.INSTALLED_APPS])
File "/usr/lib/python2.7/site-packages/djcelery/loaders.py", line 203, in find_related_module
return importlib.import_module('{0}.{1}'.format(app, related_name))
File "/usr/lib64/python2.7/importlib/init.py", line 37, in import_module
import(name)
File "/software/saltstack/gui/saltshaker/shaker/tasks.py", line 10, in
sapi = SaltAPI()
File "/software/saltstack/gui/saltshaker/shaker/shaker_core.py", line 20, in init
content = self.postRequest(obj, prefix='/login')
File "/software/saltstack/gui/saltshaker/shaker/shaker_core.py", line 30, in postRequest
content = json.loads(opener.read())
File "/usr/lib64/python2.7/json/init.py", line 338, in loads
return _default_decoder.decode(s)
File "/usr/lib64/python2.7/json/decoder.py", line 365, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File "/usr/lib64/python2.7/json/decoder.py", line 383, in raw_decode
raise ValueError("No JSON object could be decoded")
ValueError: No JSON object could be decoded

@net592
Copy link
Contributor

net592 commented May 27, 2016

看起来像是某些字符串编码异常,请保障修改修改配置时确保为无BOM的Json字符串,Python中的Json库,才可以正确解析的。当然我也是猜的,没遇到过这个问题哈

@SolarisYan
Copy link
Author

我使用 python 的 requests 库 替换 urllib 和 urllib2 重写了一下shaker_core.py,可以了

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants