AlanDecode/Maverick

修改了Config 文件 不起反应 python报错

JosephLeeG opened this issue · 6 comments

Problem description
第一次在root目录下安装maverick,可以运行没报错,后来用webdav挂载了坚果云, Config修改为源目录为webdav挂载的坚果云后报错了,权限没问题,也都是build feed 出错,重装maverick到www目录,修改了权限也是build feed出错,运行日志中的source 也不是config中的/www/maverick/diary 而是默认的/www/maverick/test_src/ 不知道哪出了问题。

Environment and configuration
Ubuntu 20.10 (GNU/Linux 5.8.0-38-generic x86_64)
Python 3.8.6
pip 20.1.1 from /usr/lib/python3/dist-packages/pip (python 3.8)

**报错日志
root@vultr:~# python /www/maverick/build.py
Site prefix: /
Source dir: /www/maverick/test_src/
Build dir: ./test_dist/
Start clean...done.
Loading contents...
Contents loaded.
Start setup_theme...
done.
Start build_search_cache...
Sizeinfo hit cache: ./assets/2934349b033b5bb5a19efc7233d3d539b700bcf5.jpg (836, 450)
Sizeinfo hit cache: ./assets/IMG_0073.jpeg (4032, 2688)
Sizeinfo hit cache: ./assets/1463017562.jpg (2690, 2688)
Sizeinfo hit cache: ./assets/IMG_0053.jpeg (4032, 2688)
Sizeinfo hit cache: ./assets/IMG_0039.jpeg (4032, 2688)
Sizeinfo hit cache: ./assets/IMG_0051.jpeg (4032, 2688)
Sizeinfo hit cache: ./assets/IMG_0005.jpeg (4032, 2688)
done.
Start build_posts...
Finished: Overview of Maverick
Finished: Typography
done.
Start build_pages...
Finished: About
done.
Start build_index...done.
Start build_archives...done.
Start build_categories...done.
Start build_tags...done.
Start _build_static...done.
Start _build_feed...Traceback (most recent call last):
File "/www/maverick/build.py", line 43, in
main(sys.argv[1:])
File "/www/maverick/build.py", line 39, in main
builder.build_all()
File "/www/maverick/Maverick/Builder.py", line 173, in build_all
self._template.render(self._config, self._posts, self._pages)
File "/www/maverick/Templates/Galileo/init.py", line 22, in render
Galileo(conf, posts, pages)()
File "/www/maverick/Maverick/Template.py", line 158, in call
self._build_feed()
File "/www/maverick/Maverick/Utils.py", line 42, in wrapper
func(*args, **kwargs)
File "/www/maverick/Maverick/Template.py", line 91, in _build_feed
fg.rss_file(unify_joinpath(self._config.build_dir, 'feed/index.xml'))
File "/usr/local/lib/python3.8/dist-packages/feedgen/feed.py", line 415, in rss_file
feed, doc = self._create_rss(extensions=extensions)
File "/usr/local/lib/python3.8/dist-packages/feedgen/feed.py", line 267, in _create_rss
raise ValueError('Required fields not set (%s)' % missing)
ValueError: Required fields not set (title)
**

  • Python Version: 3.8.6
  • pip Version: 20.1.1

-- coding: utf-8 --

"""Sample Configuration
"""

For Maverick

site_prefix = "/"
source_dir = "/www/maverick/diary/"
build_dir = "/www/wwwroot/blog/"
template = "Galileo"
index_page_size = 10
archives_page_size = 30
fetch_remote_imgs = True
enable_jsdelivr = {
"enabled": False,
"repo": "AlanDecode/Maverick@gh-pages"
}
locale = "Asia/Shanghai"
category_by_folder = False
Additional information

手动指定配置文件:

python build.py —config /path/to/config

Last login: Tue Jan 19 05:56:04 2021 from 127.0.0.1
root@vultr:# python /root/Maverick/build.py -config /root/Maverick/config.py
Traceback (most recent call last):
File "/root/Maverick/build.py", line 43, in
main(sys.argv[1:])
File "/root/Maverick/build.py", line 26, in main
g_conf.update_fromfile(opts.get('-c', None))
File "/root/Maverick/Maverick/Config.py", line 17, in update_fromfile
module = import(name)
ModuleNotFoundError: No module named 'onfig'
root@vultr:
# python /root/Maverick/build.py -config /root/Maverick/config
Traceback (most recent call last):
File "/root/Maverick/build.py", line 43, in
main(sys.argv[1:])
File "/root/Maverick/build.py", line 26, in main
g_conf.update_fromfile(opts.get('-c', None))
File "/root/Maverick/Maverick/Config.py", line 17, in update_fromfile
module = import(name)
ModuleNotFoundError: No module named 'onfig'
root@vultr:# python /root/Maverick/build.py -config /root/Maverick/Maverick/config.py
Traceback (most recent call last):
File "/root/Maverick/build.py", line 43, in
main(sys.argv[1:])
File "/root/Maverick/build.py", line 26, in main
g_conf.update_fromfile(opts.get('-c', None))
File "/root/Maverick/Maverick/Config.py", line 17, in update_fromfile
module = import(name)
ModuleNotFoundError: No module named 'onfig'
root@vultr:
# python /root/Maverick/build.py -config /root/Maverick/Maverick/config
Traceback (most recent call last):
File "/root/Maverick/build.py", line 43, in
main(sys.argv[1:])
File "/root/Maverick/build.py", line 26, in main
g_conf.update_fromfile(opts.get('-c', None))
File "/root/Maverick/Maverick/Config.py", line 17, in update_fromfile
module = import(name)
ModuleNotFoundError: No module named 'onfig'
root@vultr:# python /www/maverick/build.py -config /www/maverick/config.py
Traceback (most recent call last):
File "/www/maverick/build.py", line 43, in
main(sys.argv[1:])
File "/www/maverick/build.py", line 26, in main
g_conf.update_fromfile(opts.get('-c', None))
File "/www/maverick/Maverick/Config.py", line 17, in update_fromfile
module = import(name)
ModuleNotFoundError: No module named 'onfig'
root@vultr:
#

抱歉,命令有误,应该是:

python build.py --config /path/to/config

iPhone 输入时,-- 被自动纠正成了 ……

文件源没问题了,但是报错

root@vultr:~/Maverick# python /www/Maverick/build.py --config /path/to/config
Site prefix: /
Source dir: /www/Maverick/diary/
Build dir: /www/wwwroot/blog/
Start clean...done.
Loading contents...
Traceback (most recent call last):
  File "/www/Maverick/build.py", line 43, in <module>
    main(sys.argv[1:])
  File "/www/Maverick/build.py", line 39, in main
    builder.build_all()
  File "/www/Maverick/Maverick/Builder.py", line 142, in build_all
    content = Content(content_path)
  File "/www/Maverick/Maverick/Content.py", line 33, in __init__
    self.meta = Metadata(yaml.safe_load(m.group(1)))
  File "/usr/lib/python3/dist-packages/yaml/__init__.py", line 162, in safe_load
    return load(stream, SafeLoader)
  File "/usr/lib/python3/dist-packages/yaml/__init__.py", line 114, in load
    return loader.get_single_data()
  File "/usr/lib/python3/dist-packages/yaml/constructor.py", line 49, in get_single_data
    node = self.get_single_node()
  File "/usr/lib/python3/dist-packages/yaml/composer.py", line 36, in get_single_node
    document = self.compose_document()
  File "/usr/lib/python3/dist-packages/yaml/composer.py", line 55, in compose_document
    node = self.compose_node(None, None)
  File "/usr/lib/python3/dist-packages/yaml/composer.py", line 84, in compose_node
    node = self.compose_mapping_node(anchor)
  File "/usr/lib/python3/dist-packages/yaml/composer.py", line 127, in compose_mapping_node
    while not self.check_event(MappingEndEvent):
  File "/usr/lib/python3/dist-packages/yaml/parser.py", line 98, in check_event
    self.current_event = self.state()
  File "/usr/lib/python3/dist-packages/yaml/parser.py", line 438, in parse_block_mapping_key
    raise ParserError("while parsing a block mapping", self.marks[-1],
yaml.parser.ParserError: while parsing a block mapping
  in "<unicode string>", line 2, column 1:
    layout: post
    ^
expected <block end>, but found '<block mapping start>'
  in "<unicode string>", line 11, column 2:
     tags: 
     ^
root@vultr:~/Maverick# python /www/Maverick/build.py --config /www/Maverick/config
Site prefix: /
Source dir: /www/Maverick/diary/
Build dir: /www/wwwroot/blog/
Start clean...done.
Loading contents...
Traceback (most recent call last):
  File "/www/Maverick/build.py", line 43, in <module>
    main(sys.argv[1:])
  File "/www/Maverick/build.py", line 39, in main
    builder.build_all()
  File "/www/Maverick/Maverick/Builder.py", line 142, in build_all
    content = Content(content_path)
  File "/www/Maverick/Maverick/Content.py", line 33, in __init__
    self.meta = Metadata(yaml.safe_load(m.group(1)))
  File "/usr/lib/python3/dist-packages/yaml/__init__.py", line 162, in safe_load
    return load(stream, SafeLoader)
  File "/usr/lib/python3/dist-packages/yaml/__init__.py", line 114, in load
    return loader.get_single_data()
  File "/usr/lib/python3/dist-packages/yaml/constructor.py", line 49, in get_single_data
    node = self.get_single_node()
  File "/usr/lib/python3/dist-packages/yaml/composer.py", line 36, in get_single_node
    document = self.compose_document()
  File "/usr/lib/python3/dist-packages/yaml/composer.py", line 55, in compose_document
    node = self.compose_node(None, None)
  File "/usr/lib/python3/dist-packages/yaml/composer.py", line 84, in compose_node
    node = self.compose_mapping_node(anchor)
  File "/usr/lib/python3/dist-packages/yaml/composer.py", line 127, in compose_mapping_node
    while not self.check_event(MappingEndEvent):
  File "/usr/lib/python3/dist-packages/yaml/parser.py", line 98, in check_event
    self.current_event = self.state()
  File "/usr/lib/python3/dist-packages/yaml/parser.py", line 438, in parse_block_mapping_key
    raise ParserError("while parsing a block mapping", self.marks[-1],
yaml.parser.ParserError: while parsing a block mapping
  in "<unicode string>", line 2, column 1:
    layout: post
    ^
expected <block end>, but found '<block mapping start>'
  in "<unicode string>", line 11, column 2:
     tags: 
     ^

你的某一篇文章里 frontmatter 格式有错,检查一下

Fixed, Thx