Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AttributeError: 'module' object has no attribute 'version' with Markdown 3.0 release #6203

Closed
6 tasks done
lucemia opened this issue Sep 22, 2018 · 5 comments
Closed
6 tasks done

Comments

@lucemia
Copy link

lucemia commented Sep 22, 2018

Checklist

  • I have verified that that issue exists against the master branch of Django REST framework.
  • I have searched for similar issues in both open and closed tickets and cannot find a duplicate.
  • This is not a usage question. (Those should be directed to the discussion group instead.)
  • This cannot be dealt with as a third party library. (We prefer new functionality to be in the form of third party libraries where possible.)
  • I have reduced the issue to the simplest possible case.
  • I have included a failing test as a pull request. (If you are unable to do so we can still accept the issue.)

Steps to reproduce

The newest release Markdown 3.0 break rest_framework
https://pypi.org/project/Markdown/#history

pip install Markdown==3.0

In [1]: from rest_framework import compat
---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
<ipython-input-1-482462874c04> in <module>()
----> 1 from rest_framework import compat

./venv/lib/python2.7/site-packages/rest_framework/compat.py in <module>()
    159     import markdown
    160 
--> 161     if markdown.version <= '2.2':
    162         HEADERID_EXT_PATH = 'headerid'
    163         LEVEL_PARAM = 'level'

AttributeError: 'module' object has no attribute 'version'
@lucemia lucemia changed the title Markdown 3.0 release break AttributeError: 'module' object has no attribute 'version' with Markdown 3.0 release Sep 22, 2018
lucemia added a commit to lucemia/django-rest-framework that referenced this issue Sep 22, 2018
@DomHudson
Copy link

This is also happening with me. An appropriate attribute is __version__:

Python 3.6.6 (default, Sep 12 2018, 18:26:19) 
[GCC 8.0.1 20180414 (experimental) [trunk revision 259383]] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import markdown
>>> markdown.version
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
AttributeError: module 'markdown' has no attribute 'version'
>>> markdown.__version__
'3.0'

acdha added a commit to LibraryOfCongress/concordia that referenced this issue Sep 23, 2018
acdha added a commit to LibraryOfCongress/concordia that referenced this issue Sep 23, 2018
acdha added a commit to LibraryOfCongress/concordia that referenced this issue Sep 24, 2018
acdha added a commit to LibraryOfCongress/concordia that referenced this issue Sep 24, 2018
acdha added a commit to LibraryOfCongress/concordia that referenced this issue Sep 24, 2018
acdha added a commit to LibraryOfCongress/concordia that referenced this issue Sep 24, 2018
Eimis added a commit to zimmerman-team/IATI.cloud that referenced this issue Sep 25, 2018
@nerdoc
Copy link

nerdoc commented Sep 25, 2018

Eh - this is no fix - "use an old version". Why just don't you check for markdown.__version__, as suggested? Does Markdown 3 break DRF, or does simply DRF use an old attr. BTW,[Markdown resurrected the variable], so this bug could be closed just by waiting on markdown>=3.0.1 or so.
Why don't patch DRF to use version?

@tomchristie
Copy link
Member

Why don't patch DRF to use version?

We could, yes. Tho that's not supported until the most recent release - 3.0, so we'd need to do a more careful check ("Use this attribute if it exists, otherwise use that one")

@zyv
Copy link
Contributor

zyv commented Sep 27, 2018

FYI, markdown 3.0.1 with compatibility fix (version) has been released, so, I guess, this ticket can be closed.

Python-Markdown/markdown@6323ba6

@rpkilby
Copy link
Member

rpkilby commented Sep 30, 2018

Thanks for the update @zyv!

@rpkilby rpkilby closed this as completed Sep 30, 2018
regit pushed a commit to StamusNetworks/scirius that referenced this issue Oct 4, 2018
acmnu added a commit to arenadata/adcm that referenced this issue Feb 3, 2020
Upstream issue encode/django-rest-framework#6203
was fixed so I think we can remove that restriction.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants