Comments (4)
How did you install markdown?
Was the 2to3 tool run on the source before installation?
If I recall correctly the import path for html.entities is one of the
things the 2to3 tool changes, which suggests to me that the 2to3 tool
wasn't run before installation.
Unfortunately, when we released Markdown 2.0.3 we had not yet set up
the installation so that the 2to3 tool would run automatically. This
has since been rectified and will be available in our next release.
On Mon, Jun 27, 2011 at 6:10 AM, sfstpala
[email protected]
wrote:
I'm getting a
NameError
when trying to parse an email address like this:markdown.markdown("[email protected]")
Here's the complete traceback:
>>> import markdown
>>> markdown.markdown("[email protected]")
Traceback (most recent call last):
File "", line 1, in
File "/usr/local/lib/python3.2/dist-packages/markdown/init.py", line 598, in markdown
return md.convert(text)
File "/usr/local/lib/python3.2/dist-packages/markdown/init.py", line 395, in convert
newRoot = treeprocessor.run(root)
File "/usr/local/lib/python3.2/dist-packages/markdown/treeprocessors.py", line 271, in run
text), child)
File "/usr/local/lib/python3.2/dist-packages/markdown/treeprocessors.py", line 95, in __handleInline
data, patternIndex, startIndex)
File "/usr/local/lib/python3.2/dist-packages/markdown/treeprocessors.py", line 219, in __applyPattern
node = pattern.handleMatch(match)
File "/usr/local/lib/python3.2/dist-packages/markdown/inlinepatterns.py", line 363, in handleMatch
letters = [codepoint2name(ord(letter)) for letter in email]
File "/usr/local/lib/python3.2/dist-packages/markdown/inlinepatterns.py", line 363, in
letters = [codepoint2name(ord(letter)) for letter in email]
File "/usr/local/lib/python3.2/dist-packages/markdown/inlinepatterns.py", line 357, in codepoint2name
entity = html.entities.codepoint2name.get(code)
NameError: global name 'html' is not definedHope this helps. In the meantime, any workarounds would be appreciated.
This is Markdown 2.0.3 running on Python 3.2
Reply to this email directly or view it on GitHub:
#29
\X/ /-\ `/ |_ /-\ ||
Waylan Limberg
from markdown.
The Code I'm using comes from EnigmaCurry's repo. It's supposedly nothing more than 2.0.3 run through 2to3. Should I do it differently until the next release?
On a side note: Perhaps you should remove the Python 3 tag from the PyPI entry until the usual installation works.
Thanks a lot for the prompt reply. It's a big help, since I have this version of Python Markdown running on a production server.
from markdown.
Ok, I just looked at the source (and EnigmaCurry's repo - interesting I didn't know it existed). The problem stems from a bug in the 2to3 tool which shipped with Python 3.0, which was the only version available when we shipped Markdown 2.0.3. That bug has since been fixed in Python 3.1. Unfortunately, the fix in the Python 3.1+ version of the 2to3 tool broke our workaround.
As we have already fixed this in our repo (next release coming soon), I'd suggest filing a bug report with EnigmaCurry to fix the import in markdown/inlinepatterns.py line 48. Probably something like this (untested):
+ import html
- if sys.version >= "3.0":
- from html import entities as htmlentitydefs
- else:
- import html.entities
Regarding our claim to support Python 3.0. That is correct, Markdown 2.0.3 only supports (the buggy) Python 3.0, not 3.1 or greater. Therefore, I will not be changing our note in that regard. However, our next release will not support Python 3.0 but will support Python3.1 or greater.
As there is no issue for use to fix here, I'm closing this.
from markdown.
This is excellent, thanks a lot Waylan.
Here's what I'm running now:
+ import html.entities
- if sys.version >= "3.0":
- from html import entities as htmlentitydefs
- else:
- import html.entities
from markdown.
Related Issues (20)
- Tables in blockquotes with nl2br extension HOT 2
- API docs are not being properly indexed for search HOT 18
- Strange and inconsistent parsing of lists with headers and multiple lines HOT 6
- The title from `toc_tokens` ignores the `smarty` extension HOT 3
- BlockProcessor output wrapped in p tag HOT 9
- Trying to migrate from `markdown2`, lists without blank lines not working HOT 3
- "Unterminated character set" exception when using extra extension HOT 6
- <table> improperly wrapped by <p> when inside a list HOT 1
- Add Support for Tab Customization in Code Blocks HOT 3
- List not rendering correctly when preceded by word HOT 1
- add a buildin Mermaid extention HOT 1
- No table support? HOT 8
- GFM alerts HOT 2
- TOC extension: ignore headers above [TOC] marker HOT 2
- Fenced code blocks with newlines not parsed into html <code> blocks HOT 2
- convert \u2028 to <br>? HOT 2
- `abbr` extension breaks title attribute added using `attr_list` HOT 1
- Separate extensions from core
- no anchors are created HOT 8
- A line ending that is preceded by a backslash is not parsed as a hard line break HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from markdown.