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

RSS解析时出现 SAXParseException is not JSON serializable #145

Closed
lunzima opened this issue Jun 28, 2021 · 3 comments
Closed

RSS解析时出现 SAXParseException is not JSON serializable #145

lunzima opened this issue Jun 28, 2021 · 3 comments

Comments

@lunzima
Copy link

lunzima commented Jun 28, 2021

使用的版本是Release 2.2.6

06-28 10:40:10 [INFO] nonebot | 狼叔WolF 检查更新
06-28 10:40:10 [ERROR] apscheduler | Job "check_update (trigger: interval[0:01:00], next run at: 2021-06-28 10:41:15 CST)" raised an exception
Traceback (most recent call last):
File "", line 1, in
File "/usr/lib/python3.8/multiprocessing/spawn.py", line 116, in spawn_main
exitcode = _main(fd, parent_sentinel)
File "/usr/lib/python3.8/multiprocessing/spawn.py", line 129, in _main
return self._bootstrap(parent_sentinel)
File "/usr/lib/python3.8/multiprocessing/process.py", line 315, in _bootstrap
self.run()
File "/usr/lib/python3.8/multiprocessing/process.py", line 108, in run
self._target(*self._args, **self._kwargs)
File "/usr/local/lib/python3.8/dist-packages/uvicorn/subprocess.py", line 61, in subprocess_started
target(sockets=sockets)
File "/usr/local/lib/python3.8/dist-packages/uvicorn/server.py", line 49, in run
loop.run_until_complete(self.serve(sockets=sockets))
File "/usr/local/lib/python3.8/dist-packages/apscheduler/executors/base_py3.py", line 30, in run_coroutine_job
retval = await job.func(*job.args, **job.kwargs)
File "lzmbot/plugins/rss/RSS/util.py", line 13, in wrapper
return await asyncio.wait_for(
File "/usr/lib/python3.8/asyncio/tasks.py", line 483, in wait_for
return fut.result()
File "lzmbot/plugins/rss/RSS/my_trigger.py", line 16, in check_update
await rss_parsing.start(rss)
File "lzmbot/plugins/rss/RSS/rss_parsing.py", line 91, in start
write_rss(name=rss.name, new_rss=new_rss)
File "lzmbot/plugins/rss/RSS/rss_parsing.py", line 871, in write_rss
dump_f.write(json.dumps(old, sort_keys=True, indent=4, ensure_ascii=False))
File "/usr/lib/python3.8/json/init.py", line 234, in dumps
return cls(
File "/usr/lib/python3.8/json/encoder.py", line 201, in encode
chunks = list(chunks)
File "/usr/lib/python3.8/json/encoder.py", line 431, in _iterencode
yield from _iterencode_dict(o, _current_indent_level)
File "/usr/lib/python3.8/json/encoder.py", line 405, in _iterencode_dict
yield from chunks
File "/usr/lib/python3.8/json/encoder.py", line 438, in _iterencode
o = _default(o)
File "/usr/lib/python3.8/json/encoder.py", line 179, in default
raise TypeError(f'Object of type {o.class.name} '
TypeError: Object of type SAXParseException is not JSON serializable

@lunzima
Copy link
Author

lunzima commented Jun 28, 2021

之后第二次检查RSS时则出现

06-28 10:45:45 [ERROR] apscheduler | Job "check_update (trigger: interval[0:01:00], next run at: 2021-06-28 10:46:51 CST)" raised an exception
Traceback (most recent call last):
File "/usr/local/bin/nb", line 8, in
sys.exit(main())
File "/usr/local/lib/python3.8/dist-packages/click/core.py", line 829, in call
return self.main(*args, **kwargs)
File "/usr/local/lib/python3.8/dist-packages/click/core.py", line 782, in main
rv = self.invoke(ctx)
File "/usr/local/lib/python3.8/dist-packages/click/core.py", line 1259, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "/usr/local/lib/python3.8/dist-packages/click/core.py", line 1066, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "/usr/local/lib/python3.8/dist-packages/click/core.py", line 610, in invoke
return callback(*args, **kwargs)
File "/usr/local/lib/python3.8/dist-packages/nb_cli/commands/main.py", line 26, in run
run_bot(file, app)
File "/usr/local/lib/python3.8/dist-packages/nb_cli/handlers/deploy.py", line 25, in run_bot
nonebot.run(app=f"{module_name}:{app}")
File "/usr/local/lib/python3.8/dist-packages/nonebot/init.py", line 227, in run
get_driver().run(host, port, *args, **kwargs)
File "/usr/local/lib/python3.8/dist-packages/nonebot/drivers/fastapi.py", line 170, in run
uvicorn.run(app or self.server_app,
File "/usr/local/lib/python3.8/dist-packages/uvicorn/main.py", line 386, in run
server.run()
File "/usr/local/lib/python3.8/dist-packages/uvicorn/server.py", line 49, in run
loop.run_until_complete(self.serve(sockets=sockets))
File "/usr/local/lib/python3.8/dist-packages/apscheduler/executors/base_py3.py", line 30, in run_coroutine_job
retval = await job.func(*job.args, **job.kwargs)
File "lzmbot/plugins/rss/RSS/util.py", line 13, in wrapper
return await asyncio.wait_for(
File "/usr/lib/python3.8/asyncio/tasks.py", line 483, in wait_for
return fut.result()
File "lzmbot/plugins/rss/RSS/my_trigger.py", line 16, in check_update
await rss_parsing.start(rss)
File "lzmbot/plugins/rss/RSS/rss_parsing.py", line 89, in start
old_rss_list = read_rss(rss.name).get("entries")
File "lzmbot/plugins/rss/RSS/rss_parsing.py", line 849, in read_rss
load_dict = json.load(load_f)
File "/usr/lib/python3.8/json/init.py", line 293, in load
return loads(fp.read(),
File "/usr/lib/python3.8/json/init.py", line 357, in loads
return _default_decoder.decode(s)
File "/usr/lib/python3.8/json/decoder.py", line 337, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File "/usr/lib/python3.8/json/decoder.py", line 355, in raw_decode
raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

@NekoAria
Copy link
Collaborator

能把你的这个订阅的地址发一下吗?
这个情况是由于订阅没内容导致的。
不过也确实应该改一下处理逻辑。

@lunzima
Copy link
Author

lunzima commented Jun 28, 2021

感谢修复

@lunzima lunzima closed this as completed Jun 28, 2021
Quan666 pushed a commit that referenced this issue Jun 28, 2021
Fix #145;订阅参数增加 `停止更新` 设置项
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