I am trying to post to my pelican blog from another python app, so I am not doing pelican ./output -s settings.py
from the commandline.
I have modified pelican to accept mocked argparse like object to pass what it needs, so I have moved the content of the main
function in __init__.py
to function named runPelican(args)
that accepts args, and from my app that has mocked Argparse like this,
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
I am calling the runPelican from my python app like this:
if make_entry(args):
import pelican
arg = MockArgparse(path=CONTENT_PATH, theme=THEME_PATH, output=OUTPUT_PATH, settings=SETTINGS_PATH)
pelican.runPelican(arg)
Everything seems to go fine but the blog posts are not generated and Only error I am getting is
CRITICAL: SimplerXMLGenerator instance has no attribute '_write'
any help would be greatly appreciated.