getpelican / pelican

Static site generator that supports Markdown and reST syntax. Powered by Python.
https://getpelican.com
GNU Affero General Public License v3.0
12.57k stars 1.81k forks source link

"Overwrite" error on feed files when running develop_server.sh #1949

Closed dmark closed 8 years ago

dmark commented 8 years ago

This is a new pelican 3.6.3 installation, with content files migrated from an older installation. If I edit any of my content files after having run "develop_server.sh start", I get the error below. If develop_server.sh is not running, there are no errors after manually running pelican.

-> Modified: content. re-generating...
CRITICAL: RuntimeError: File /home/citmkd/pelican/dmark.github.io/output/feeds/comment.lfcs.atom.xml is to be overwritten
Traceback (most recent call last):
  File "/home/citmkd/virtualenvs/pelican/bin/pelican", line 11, in <module>
    sys.exit(main())
  File "/home/citmkd/virtualenvs/pelican/local/lib/python2.7/site-packages/pelican/__init__.py", line 456, in main
    pelican.run()
  File "/home/citmkd/virtualenvs/pelican/local/lib/python2.7/site-packages/pelican/__init__.py", line 175, in run
    p.generate_context()
  File "/home/citmkd/virtualenvs/pelican/local/lib/python2.7/site-packages/pelican/generators.py", line 583, in generate_context
    signals.article_generator_finalized.send(self)
  File "/home/citmkd/virtualenvs/pelican/local/lib/python2.7/site-packages/blinker/base.py", line 267, in send
    for receiver in self.receivers_for(sender)]
  File "/home/citmkd/github/pelican-plugins/pelican_comment_system/pelican_comment_system.py", line 129, in process_comments
    add_static_comments(article_generator, article)
  File "/home/citmkd/github/pelican-plugins/pelican_comment_system/pelican_comment_system.py", line 160, in add_static_comments
    write_feed(gen, [], context, content.slug)
  File "/home/citmkd/github/pelican-plugins/pelican_comment_system/pelican_comment_system.py", line 124, in write_feed
    pelican_writer.write_feed(items, context, path)
  File "/home/citmkd/virtualenvs/pelican/local/lib/python2.7/site-packages/pelican/writers.py", line 118, in write_feed
    with self._open_w(complete_path, encoding) as fp:
  File "/home/citmkd/virtualenvs/pelican/local/lib/python2.7/site-packages/pelican/writers.py", line 76, in _open_w
    raise RuntimeError('File %s is to be overwritten' % filename)
RuntimeError: File /home/citmkd/pelican/dmark.github.io/output/feeds/comment.lfcs.atom.xml is to be overwritten
Scheirle commented 8 years ago

Workaround: Disable the pelican_comment_system feeds while developing. pelicanconf.py: PELICAN_COMMENT_SYSTEM_FEED = None publishconf.py: PELICAN_COMMENT_SYSTEM_FEED = 'feeds/comment.%s.atom.xml'


The problem is that if pelican runs in autoreload mode it does not reinitialize everything. (does not send signals.initialized) And therefore the pelican_comment_system uses the writer of the previous run (which then complains that it overwrites stuff)

To fix this we probably need a new signal in Pelican.run so plugins can reinitialize if needed.