GithubHelp home page GithubHelp logo

Comments (4)

waylan avatar waylan commented on May 25, 2024

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 defined

Hope 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.

sfstpala avatar sfstpala commented on May 25, 2024

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.

waylan avatar waylan commented on May 25, 2024

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.

sfstpala avatar sfstpala commented on May 25, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.