鹈鹕博客帖子未生成

2024-05-15 14:21:04 发布

您现在位置:Python中文网/ 问答频道 /正文

我正试图从另一个python应用程序发布到我的pelican博客,所以我没有从命令行执行pelican ./output -s settings.py。在

我修改了pelican以接受模拟的类似argparse的对象来传递它需要的东西,所以我有moved the content of the ^{} function in ^{}

对于名为runPelican(args)的函数,它接受args,并且在我的应用程序中,它像这样嘲笑Argparse

class MockArgparse(object):
    """Mock for argparse's to pass to pelican
    """
    def __init__(self, verbosity=True, theme=None, output=None, path=None, delete_outputdir=None, 
                settings=None, ignore_cache=None, cache_path=None, selected_paths=None, autoreload=None):
        """
            Args:
                path (str): content path
                settings(str): settings python file path
        """
        super(MockArgparse, self).__init__()
        self.theme = theme
        self.cache_path = cache_path
        self.ignore_cache = ignore_cache
        self.delete_outputdir = delete_outputdir
        self.settings = settings
        self.output = output
        self.verbosity = verbosity
        self.autoreload = autoreload
        self.path = path
        self.selected_paths = selected_paths

我从python应用程序中调用runPelican,如下所示:

^{pr2}$

一切似乎都很顺利,但博客帖子并没有生成 我唯一的错误是

CRITICAL: SimplerXMLGenerator instance has no attribute '_write'

任何帮助都将不胜感激。在


Tags: pathselfnone应用程序cacheoutputsettingsdelete