鹈鹕博客帖子没有生成

时间:2015-06-20 09:48:02

标签: python pelican

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

我修改了pelican以接受像对象一样的模拟argparse来传递它需要的东西,所以我有moved the content of the main function in __init__.py

到名为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,如下所示:

if make_entry(args):
    import pelican
    arg = MockArgparse(path=CONTENT_PATH, theme=THEME_PATH, output=OUTPUT_PATH, settings=SETTINGS_PATH)
    pelican.runPelican(arg)

一切似乎都很好,但博客文章没有生成 只有我得到的错误是

CRITICAL: SimplerXMLGenerator instance has no attribute '_write'

任何帮助将不胜感激。

0 个答案:

没有答案