Introductory tutorial: 'OrderedDict' object has no attribute 'deregister'
stationname opened this issue · comments
-
I have read the Filing Issues and subsequent “How to Get Help” sections of the documentation.
-
I have searched the issues (including closed ones) and believe that this is not a duplicate.
-
OS version and name: macOS Ventura 13.5.1
-
Python version: 3.11.3
-
Pelican version: 4.8.0
-
invoke version:: 2.2.0
-
Link to theme: none
-
Links to plugins:
No plugins are installed
-
Link to your site: none
-
Link to your source: none
-
Link to a Gist with the contents of your settings file: none
Issue
Get Could not process posts/gunship.markdown 'OrderedDict' object has no attribute 'deregister'
when following the introductory tutorial
- I followed the introductory tutorial, which is linked on the github tutorial page:
- run
pelican-quickstart
- Answers:
> What will be the title of this web site? mytest
> Who will be the author of this web site? myself
> What will be the default language of this web site? [en]
> Do you want to specify a URL prefix? e.g., https://example.com (Y/n) n
> Do you want to enable article pagination? (Y/n) n
> What is your time zone? [Europe/Rome] Asia/Tokyo
> Do you want to generate a tasks.py/Makefily
> Do you want to upload your website using FTP? (y/N) n
> Do you want to upload your website using SSH? (y/N) n
> Do you want to upload your website using Dropbox? (y/N) n
> Do you want to upload your website using S3? (y/N) n
> Do you want to upload your website using Rackspace Cloud Files? (y/N) n
> Do you want to upload your website using GitHub Pages? (y/N) n
- create
content/posts/gunship.markdown
.
Content:
slug: gunship
category: bands
date: 2017-06-09
modified: 2017-06-09
[Gunship](https://www.gunshipmusic.com/) is a *retro synthwave* artist out of the UK.
[Revel in Your Time](https://www.youtube.com/watch?v=uYRZV8dV10w),
[Tech Noir](https://www.youtube.com/watch?v=-nC5TBv3sfU),
[Fly for Your Life](https://www.youtube.com/watch?v=Jv1ZN8c4_Gs)
and
[The Mountain](https://www.youtube.com/watch?v=-HYRTJr8EyA)
are all quality songs by Gunship. Check out those amazing music videos!
Also take a look at other retro synthwave artists such as
[Trevor Something](https://trevorsomething.bandcamp.com/),
[Droid Bishop](https://droidbishop.bandcamp.com/),
[FM-84](https://fm84.bandcamp.com/)
and
[Daniel Deluxe](https://danieldeluxe.bandcamp.com/).
- run
invoke build
. - expected: static site is generated.
- actual: error
'OrderedDict' object has no attribute 'deregister'
Error Analysis:
The error appears here:
site-packages/pelican/readers.py", line 308, in
_parse_metadata
self._md.preprocessors.deregister("meta")
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'OrderedDict' object has no attribute
'deregister'
Hi @stationname. How exactly did you install Pelican? Are you certain you are using Pelican 4.8? I ask because version 4.9 was just released a few hours before you filed this issue. Please ensure you are using the new 4.9 version.
Also, please run: pelican-plugins
What output is shown?
I tested on Pelican 4.9 the exact set of steps you described and could not reproduce the error.
@justinmayer Thank you for taking this on.
pelican-plugins
saidNo plugins are installed
.- Testing with Pelican 4.9.0, gave the same error.
How exactly did you install Pelican? Are you certain you are using Pelican 4.8? I ask because version
I'm certain the version is correct:
How I install:
- create requirements.txt file
- add
pelican==4.9.0
(orpelican==4.8.0
) - enter virtual environment
- run
pip install -r requirements.txt
For reference:
pelican is not installed outside of the venv. So there should be no interferring.
Others:
- I added a screenshot of the error in the first post.
- Do you have anything that I could look at to analyze what's going on? The error doesn't really tell much.
- I should mention, I'm using an M1 chip (ARM)
I ran pelican
with --debug
; Here's the output (didn't analyze, yet; will do from now).
(.venv) 19:47:14 ~/mypath $ pelican --debug -r content -o output -s pelicanconf.py
[19:47:23] DEBUG Pelican version: 4.9.0 __init__.py:627
DEBUG Python version: 3.11.3 __init__.py:628
DEBUG Adding current directory to system path __init__.py:71
DEBUG Finding namespace plugins _utils.py:97
--- AutoReload Mode: Monitoring `content`, `theme` and `settings` for changes.
---
DEBUG Found generator: ArticlesGenerator (internal) __init__.py:229
DEBUG Found generator: PagesGenerator (internal) __init__.py:229
DEBUG Found generator: StaticGenerator (internal) __init__.py:229
DEBUG Template list: ['!simple/archives.html', generators.py:91
'!simple/article.html', '!simple/author.html',
'!simple/authors.html', '!simple/base.html',
'!simple/categories.html',
'!simple/category.html', '!simple/index.html',
'!simple/page.html',
'!simple/pagination.html',
'!simple/period_archives.html',
'!simple/tag.html', '!simple/tags.html',
'!simple/translations.html',
'!theme/analytics.html',
'!theme/archives.html', '!theme/article.html',
'!theme/article_infos.html',
'!theme/author.html', '!theme/authors.html',
'!theme/base.html', '!theme/categories.html',
'!theme/category.html',
'!theme/comments.html',
'!theme/disqus_script.html',
'!theme/github.html', '!theme/index.html',
'!theme/page.html',
'!theme/period_archives.html',
'!theme/tag.html', '!theme/taglist.html',
'!theme/tags.html',
'!theme/translations.html',
'!theme/twitter.html', 'analytics.html',
'archives.html', 'article.html',
'article_infos.html', 'author.html',
'authors.html', 'base.html',
'categories.html', 'category.html',
'comments.html', 'disqus_script.html',
'github.html', 'index.html', 'page.html',
'pagination.html', 'period_archives.html',
'tag.html', 'taglist.html', 'tags.html',
'translations.html', 'twitter.html']
DEBUG Read file posts/gunship.markdown -> Article readers.py:562
DEBUG Signal readers.py:572
article_generator_preread.send(ArticlesGenerator
)
DEBUG Successfuly imported extension module __init__.py:232
"markdown.extensions.codehilite".
DEBUG Successfully loaded extension __init__.py:188
"markdown.extensions.codehilite.CodeHiliteExten
sion".
DEBUG Successfuly imported extension module __init__.py:232
"markdown.extensions.extra".
DEBUG Successfuly imported extension module __init__.py:232
"markdown.extensions.smart_strong".
DEBUG Successfully loaded extension __init__.py:188
"markdown.extensions.smart_strong.SmartEmphasis
Extension".
DEBUG Successfuly imported extension module __init__.py:232
"markdown.extensions.fenced_code".
DEBUG Successfully loaded extension __init__.py:188
"markdown.extensions.fenced_code.FencedCodeExte
nsion".
DEBUG Successfuly imported extension module __init__.py:232
"markdown.extensions.footnotes".
DEBUG Successfully loaded extension __init__.py:188
"markdown.extensions.footnotes.FootnoteExtensio
n".
DEBUG Successfuly imported extension module __init__.py:232
"markdown.extensions.attr_list".
DEBUG Successfully loaded extension __init__.py:188
"markdown.extensions.attr_list.AttrListExtensio
n".
DEBUG Successfuly imported extension module __init__.py:232
"markdown.extensions.def_list".
DEBUG Successfully loaded extension __init__.py:188
"markdown.extensions.def_list.DefListExtension"
.
DEBUG Successfuly imported extension module __init__.py:232
"markdown.extensions.tables".
DEBUG Successfully loaded extension __init__.py:188
"markdown.extensions.tables.TableExtension".
DEBUG Successfuly imported extension module __init__.py:232
"markdown.extensions.abbr".
DEBUG Successfully loaded extension __init__.py:188
"markdown.extensions.abbr.AbbrExtension".
DEBUG Successfully loaded extension __init__.py:188
"markdown.extensions.extra.ExtraExtension".
DEBUG Successfuly imported extension module __init__.py:232
"markdown.extensions.meta".
DEBUG Successfully loaded extension __init__.py:188
"markdown.extensions.meta.MetaExtension".
ERROR Could not process posts/gunship.markdown log.py:94
'OrderedDict' object has no attribute 'deregister'
Traceback (most recent call last):
File
"/Users/user/mypath/.venv/lib/python3.11/site-pack
ages/pelican/generators.py", line 658, in
generate_context
article = self.readers.read_file(
^^^^^^^^^^^^^^^^^^^^^^^
File
"/Users/user/mypath/.venv/lib/python3.11/site-pack
ages/pelican/readers.py", line 599, in read_file
content, reader_metadata = reader.read(path)
^^^^^^^^^^^^^^^^^
File
"/Users/user/mypath/.venv/lib/python3.11/site-pack
ages/pelican/readers.py", line 345, in read
metadata = self._parse_metadata(self._md.Meta)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File
"/Users/user/mypath/.venv/lib/python3.11/site-pack
ages/pelican/readers.py", line 308, in
_parse_metadata
self._md.preprocessors.deregister("meta")
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'OrderedDict' object has no attribute
'deregister'
[... stripped ..., because unrelated to the error]
Done: Processed 0 articles, 0 drafts, 0 hidden articles, 0 pages, 0 hidden pages
and 0 draft pages in 0.07 seconds.
WARNING Unable to watch path log.py:89
'/Users/user/mypath/content/images' as
it does not exist.
What is in the requirements.txt
? And what does pip list
show?
@stationname: Would you please provide the requested information above so we can do our best to help you?
Sorry, work week.
I found the problem.
Short:
- If I install
Markdown==2.6.8
in the same venv, the stated error occurs. - If I uninstall the package, the build works fine.
Longer:
I had Markdown==2.6.8
stated in my requirements.txt and deleted it afterwards (as you can see in the listing below). However, removing it from requirements does not remove it from venv, as can be seen in pip list (.. a peculiarity of Python... :( ).
Requested info:
Just for the record, here's the requested info:
requirements.txt
invoke
pelican==4.9.0
pip list
Package Version
--------------- ------------
anyio 4.0.0
blinker 1.7.0
docutils 0.20.1
feedgenerator 2.1.0
idna 3.4
invoke 2.2.0
Jinja2 3.1.2
Markdown 2.6.8
markdown-it-py 3.0.0
MarkupSafe 2.1.3
mdurl 0.1.2
ordered-set 4.1.0
pelican 4.9.0
pip 23.0.1
Pygments 2.16.1
python-dateutil 2.8.2
pytz 2023.3.post1
rich 13.6.0
setuptools 67.6.1
six 1.16.0
sniffio 1.3.0
Unidecode 1.3.7
watchfiles 0.21.0
Differnt problem
Now I can build, but nothing is generated. But I'll do some research and then open another report if needed.
Markdown 2.6.8
That's really, really old. I'm assuming you have that because of that tutorial, which is from 2017. Things have changed a bit since then :). Upgrade to a recent markdown
and it should be fine:
pip install -U markdown
updated the post
@avaris
your guess was right. I got it from the tutorial.
Do we close this?
@stationname said:
I followed the introductory tutorial, which is linked on the github tutorial page
Well, that is not the introductory tutorial, nor is that the tutorial page. That is a tutorial that @mattmakai wrote on his Full Stack Python site back in 2017, so it is considerably out-of-date at this point. That tutorial should probably be amended, if not in a comprehensive way, at least with python -m pip install pelican[markdown]
instead of the current pip install pelican==3.7.1 markdown==2.6.8
line.
Also, the links on that Tutorials wiki page are community-managed, which means we Pelican maintainers cannot provide support for what's contained in those tutorials. In the future, I recommend following the instructions in the official Pelican documentation, which is supported by folks here. 😊