Search code examples
pythonpython-3.xpelican

Pelican - not all arguments converted during string formatting


Fisrt creating a simple static page with pelican. Everything worked fine until i change the theme to basic theme. Locally is running fine, but i try to execute make github or make publish i'm getting this error:

CRITICAL: TypeError: not all arguments converted during string formatting Makefile:75: recipe for target 'publish' failed make: *** [publish] Error 1

I installed theme as the documentation said, but it its not working. Below is my pelicanconf.py

 #!/usr/bin/env python
# -*- coding: utf-8 -*- #
from __future__ import unicode_literals

AUTHOR = 'Isaac'
SITENAME = 'Isaac's blog'
SITEURL = ''

PATH = 'content'

TIMEZONE = 'America/Los_Angeles'

DEFAULT_LANG = 'en'

# Feed generation is usually not desired when developing
FEED_ALL_ATOM = None
CATEGORY_FEED_ATOM = None
TRANSLATION_FEED_ATOM = None
AUTHOR_FEED_ATOM = None
AUTHOR_FEED_RSS = None

# Blogroll
LINKS = (('Pelican', 'http://getpelican.com/'),
         ('Python.org', 'http://python.org/'),
         ('Jinja2', 'http://jinja.pocoo.org/'),
         ('You can modify those links in your config file', '#'),)

# Social widget
SOCIAL = (('You can add links in your config file', '#'),
          ('Another social link', '#'),)

DEFAULT_PAGINATION = 10

THEME='basic'



# Uncomment following line if you want document-relative URLs when developing
RELATIVE_URLS = True

Solution

  • Go to base.html file, which is usually in templates folder of any theme. Then find '|format(' and replace it with '.format(slug=' without quotes. That should fix the error "TypeError: not all arguments converted during string formatting."

    In other words, turn

    {{ CATEGORY_FEED_ATOM|format(category.slug) }}
    

    into

    {{ CATEGORY_FEED_ATOM.format(slug='category.slug') }}