我用的是 django 1.7.4. manage.py collectstatic 上传了一些文件后报simplejson.scanner.JSONDecodeError
。
我把收到的回复都打出来了。一开始成功的都是正常的json. 出问题的回复是一堆乱码。有谁知道该怎么办?
{"fsize":84245,"hash":"Fq-5B1LgqQwkt_ck-sqGxfPRXRF4","mimeType":"text/javascript","putTime":14251304507109030}
{"fsize":89667,"hash":"FvV0D3dfwP8YCaaDMJntg7CJbNCT","mimeType":"text/javascript","putTime":14251304510500465}
]"�%P��>z�#�h/o�C�]3�� >��݄]�P���8��3�>f~�� (� ���mşL�@���P@�B�ǭ_��L��=R9S�6n2nް�Ro�jڧla��m��c�IXu��Q;�D��9c|=u��� >��C� �c�m��_��&W ��
MEX����qbǾ�w�?\?���6��$����Wf7�/Nk�����<�:n��n�LG61�4o#�z�D�e�7�u���ݗkZ��~ ���'I1��f;��zr'��V���q�uV���3� �����"XjG9��A��}8f 9�y���umߝY�8Pz���$����3�8
�
�2�{�����&��s\d2*�0=��f7��yɢ���
²F��M�L��#+g֫Ԑ�/�\x��O�ݦf���L�;�~j����/H��_!:4�p��N(�Z�[f�����U�o�M%[�
i�i�ܹu���S:�q�x���P@�B�ǭ_��L�6?���k���� � (�jڧla��m��c�IY�]㙙�s:쥈���CC�?0��b����e���2p :�"�i,zz?Oj�@
��(�����I"��|�w����v ���_˩�{Y�`��J���D"yd�(C���K
Traceback (most recent call last):
File "manage.py", line 10, in <module>
execute_from_command_line(sys.argv)
File "/home/xx/xx/xx/lib/python3.4/site-packages/django/core/management/__init__.py", line 385, in execute_from_command_line
utility.execute()
File "/home/xx/xx/xx/lib/python3.4/site-packages/django/core/management/__init__.py", line 377, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/home/xx/xx/xx/lib/python3.4/site-packages/django/core/management/base.py", line 288, in run_from_argv
self.execute(*args, **options.__dict__)
File "/home/xx/xx/xx/lib/python3.4/site-packages/django/core/management/base.py", line 338, in execute
output = self.handle(*args, **options)
File "/home/xx/xx/xx/lib/python3.4/site-packages/django/core/management/base.py", line 533, in handle
return self.handle_noargs(**options)
File "/home/xx/xx/xx/lib/python3.4/site-packages/django/contrib/staticfiles/management/commands/collectstatic.py", line 168, in handle_noargs
collected = self.collect()
File "/home/xx/xx/xx/lib/python3.4/site-packages/django/contrib/staticfiles/management/commands/collectstatic.py", line 107, in collect
handler(path, prefixed_path, storage)
File "/home/xx/xx/xx/lib/python3.4/site-packages/django/contrib/staticfiles/management/commands/collectstatic.py", line 305, in copy_file
if not self.delete_file(path, prefixed_path, source_storage):
File "/home/xx/xx/xx/lib/python3.4/site-packages/django/contrib/staticfiles/management/commands/collectstatic.py", line 222, in delete_file
self.storage.modified_time(prefixed_path)
File "/home/xx/xx/xx/lib/python3.4/site-packages/qiniustorage/backends.py", line 120, in modified_time
stats = self._file_stat(name)
File "/home/xx/xx/xx/lib/python3.4/site-packages/qiniustorage/backends.py", line 106, in _file_stat
ret, info = self.bucket_manager.stat(self.bucket_name, name)
File "/home/xx/xx/xx/lib/python3.4/site-packages/qiniu/services/storage/bucket.py", line 49, in stat
return self.__rs_do('stat', resource)
File "/home/xx/xx/xx/lib/python3.4/site-packages/qiniu/services/storage/bucket.py", line 90, in __rs_do
return self.__server_do(config.RS_HOST, operation, *args)
File "/home/xx/xx/xx/lib/python3.4/site-packages/qiniu/services/storage/bucket.py", line 98, in __server_do
return self.__post(url)
File "/home/xx/xx/xx/lib/python3.4/site-packages/qiniu/services/storage/bucket.py", line 101, in __post
return http._post_with_auth(url, data, self.auth)
File "/home/xx/xx/xx/lib/python3.4/site-packages/qiniu/http.py", line 77, in _post_with_auth
return _post(url, data, None, RequestsAuth(auth))
File "/home/xx/xx/xx/lib/python3.4/site-packages/qiniu/http.py", line 46, in _post
return __return_wrapper(r)
File "/home/xx/xx/xx/lib/python3.4/site-packages/qiniu/http.py", line 24, in __return_wrapper
ret = resp.json() if resp.text != '' else {}
File "/home/xx/xx/xx/lib/python3.4/site-packages/requests/models.py", line 797, in json
return json.loads(self.text, **kwargs)
File "/home/xx/xx/xx/lib/python3.4/site-packages/simplejson/__init__.py", line 505, in loads
return _default_decoder.decode(s)
File "/home/xx/xx/xx/lib/python3.4/site-packages/simplejson/decoder.py", line 371, in decode
obj, end = self.raw_decode(s)
File "/home/xx/xx/xx/lib/python3.4/site-packages/simplejson/decoder.py", line 401, in raw_decode
return self.scan_once(s, idx=_w(s, idx).end())
simplejson.scanner.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
类似
{"fsize":89667,"hash":"FvV0D3dfwP8YCaaDMJntg7CJbNCT","mimeType":"text/javascript","putTime":14251304510500465}
这样的响应应该是七牛正常的上传的响应或者回调的内容。出错的响应内容不知道是在哪个步骤中出现的,是上传的回调后的响应、还是上传后的简单反馈,如果是回调后的响应那么有可能是服务器响应的内容并不是合法的json串;你这边可以打印一下上传请求七牛的response header和body信息。