Search code examples
pythonmacospelican

Pelican: "You need to specify a path containing the content"


I've been following the quick start guide to some extent, but I have run into problems. As I saw it was suggested by others, I installed Python via Homebrew (I'm on OS X) and subsequently also pip. I also used virtualenvs.

So right now I have a folder virtualenvs with a subfolder pelican containing my project (with bin, site, include, lib and output folders). In the site folder (and some subfolders) the content folder resides, which currently contains the file keyboard-review.md.

The problem occurs when trying to run pelican content as I then get:

Traceback (most recent call last):
  File "/Users/myuser/virtualenvs/pelican/bin/pelican", line 11, in <module>
    sys.exit(main())
  File "/Users/myuser/virtualenvs/pelican/lib/python2.7/site-packages/pelican/__init__.py", line 386, in main
    pelican, settings = get_instance(args)
  File "/Users/myuser/virtualenvs/pelican/lib/python2.7/site-packages/pelican/__init__.py", line 372, in get_instance
    settings = read_settings(config_file, override=get_config(args))
  File "/Users/myuser/virtualenvs/pelican/lib/python2.7/site-packages/pelican/settings.py", line 169, in read_settings
    parsed_settings = configure_settings(local_settings)
  File "/Users/myuser/virtualenvs/pelican/lib/python2.7/site-packages/pelican/settings.py", line 203, in configure_settings
    raise Exception('You need to specify a path containing the content'
Exception: You need to specify a path containing the content (see pelican --help for more information)

I've tried searching for how to do this, but I've come up short. Feels like it should be simple using pelican path but I haven't gotten it to work yet. Any help for a newbie out there?


Solution

  • if you try to run pelican with something like:

    pelican ~/virtualenvs/pelican/site/content/
    

    although specifying a file like this when using python from the terminal will work, a python program cannot use the ~/ notation when opening files so pelican has simply informed you that that is an invalid path to a file.

    To fix you simply need to specify the absolute path:

    pelican /Users/myuser/virtualenvs/pelican/site/content/