revolunet / sublimetext-markdown-preview

markdown preview and build plugin for sublime text 2/3

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[Bug] DeprecationWarning: cgi.escape is deprecated, use html.escape instead

Kristinita opened this issue · comments

Summary

Today I can not convert Markdown to HTML use MarkdownPreview.

Expected behavior

Successful conversion.

Actual behavior

command: markdown_preview_select {"target": "save"}
E:\Sublime Text 3\Data\Installed Packages\Markdown Preview.sublime-package\markdown/extensions/__init__.py:37: DeprecationWarning: Extension classes accepting positional args is pending Deprecation. Each setting should be passed into the Class as a keyword. Positional args are deprecated and will raise an error in version 2.7. See the Release Notes for Python-Markdown version 2.6 for more info.
E:\Sublime Text 3\Data\Installed Packages\Markdown Preview.sublime-package\markdown/extensions/__init__.py:37: DeprecationWarning: Extension classes accepting positional args is pending Deprecation. Each setting should be passed into the Class as a keyword. Positional args are deprecated and will raise an error in version 2.7. See the Release Notes for Python-Markdown version 2.6 for more info.
E:\Sublime Text 3\Data\Installed Packages\Markdown Preview.sublime-package\markdown/extensions/__init__.py:37: DeprecationWarning: Extension classes accepting positional args is pending Deprecation. Each setting should be passed into the Class as a keyword. Positional args are deprecated and will raise an error in version 2.7. See the Release Notes for Python-Markdown version 2.6 for more info.
E:\Sublime Text 3\Data\Installed Packages\Markdown Preview.sublime-package\markdown/extensions/__init__.py:37: DeprecationWarning: Extension classes accepting positional args is pending Deprecation. Each setting should be passed into the Class as a keyword. Positional args are deprecated and will raise an error in version 2.7. See the Release Notes for Python-Markdown version 2.6 for more info.
E:\Sublime Text 3\Data\Installed Packages\Markdown Preview.sublime-package\markdown/extensions/__init__.py:37: DeprecationWarning: Extension classes accepting positional args is pending Deprecation. Each setting should be passed into the Class as a keyword. Positional args are deprecated and will raise an error in version 2.7. See the Release Notes for Python-Markdown version 2.6 for more info.
E:\Sublime Text 3\Data\Installed Packages\Markdown Preview.sublime-package\markdown/extensions/__init__.py:37: DeprecationWarning: Extension classes accepting positional args is pending Deprecation. Each setting should be passed into the Class as a keyword. Positional args are deprecated and will raise an error in version 2.7. See the Release Notes for Python-Markdown version 2.6 for more info.
E:\Sublime Text 3\Data\Installed Packages\Markdown Preview.sublime-package\markdown/extensions/__init__.py:37: DeprecationWarning: Extension classes accepting positional args is pending Deprecation. Each setting should be passed into the Class as a keyword. Positional args are deprecated and will raise an error in version 2.7. See the Release Notes for Python-Markdown version 2.6 for more info.
E:\Sublime Text 3\Data\Installed Packages\Markdown Preview.sublime-package\markdown/extensions/__init__.py:37: DeprecationWarning: Extension classes accepting positional args is pending Deprecation. Each setting should be passed into the Class as a keyword. Positional args are deprecated and will raise an error in version 2.7. See the Release Notes for Python-Markdown version 2.6 for more info.
E:\Sublime Text 3\Data\Installed Packages\Markdown Preview.sublime-package\markdown/extensions/__init__.py:37: DeprecationWarning: Extension classes accepting positional args is pending Deprecation. Each setting should be passed into the Class as a keyword. Positional args are deprecated and will raise an error in version 2.7. See the Release Notes for Python-Markdown version 2.6 for more info.
E:\Sublime Text 3\Data\Installed Packages\Markdown Preview.sublime-package\markdown/extensions/__init__.py:37: DeprecationWarning: Extension classes accepting positional args is pending Deprecation. Each setting should be passed into the Class as a keyword. Positional args are deprecated and will raise an error in version 2.7. See the Release Notes for Python-Markdown version 2.6 for more info.
E:\Sublime Text 3\Data\Installed Packages\Markdown Preview.sublime-package\markdown/extensions/__init__.py:37: DeprecationWarning: Extension classes accepting positional args is pending Deprecation. Each setting should be passed into the Class as a keyword. Positional args are deprecated and will raise an error in version 2.7. See the Release Notes for Python-Markdown version 2.6 for more info.
E:\Sublime Text 3\Data\Installed Packages\Markdown Preview.sublime-package\markdown/extensions/__init__.py:37: DeprecationWarning: Extension classes accepting positional args is pending Deprecation. Each setting should be passed into the Class as a keyword. Positional args are deprecated and will raise an error in version 2.7. See the Release Notes for Python-Markdown version 2.6 for more info.
E:\Sublime Text 3\Data\Installed Packages\Markdown Preview.sublime-package\markdown/extensions/__init__.py:37: DeprecationWarning: Extension classes accepting positional args is pending Deprecation. Each setting should be passed into the Class as a keyword. Positional args are deprecated and will raise an error in version 2.7. See the Release Notes for Python-Markdown version 2.6 for more info.
E:\Sublime Text 3\Data\Installed Packages\Markdown Preview.sublime-package\markdown/extensions/__init__.py:37: DeprecationWarning: Extension classes accepting positional args is pending Deprecation. Each setting should be passed into the Class as a keyword. Positional args are deprecated and will raise an error in version 2.7. See the Release Notes for Python-Markdown version 2.6 for more info.
E:\Sublime Text 3\Data\Installed Packages\Markdown Preview.sublime-package\markdown/extensions/__init__.py:37: DeprecationWarning: Extension classes accepting positional args is pending Deprecation. Each setting should be passed into the Class as a keyword. Positional args are deprecated and will raise an error in version 2.7. See the Release Notes for Python-Markdown version 2.6 for more info.
E:\Sublime Text 3\Data\Installed Packages\Markdown Preview.sublime-package\markdown/extensions/__init__.py:37: DeprecationWarning: Extension classes accepting positional args is pending Deprecation. Each setting should be passed into the Class as a keyword. Positional args are deprecated and will raise an error in version 2.7. See the Release Notes for Python-Markdown version 2.6 for more info.
E:\Sublime Text 3\Data\Installed Packages\Markdown Preview.sublime-package\markdown/extensions/__init__.py:37: DeprecationWarning: Extension classes accepting positional args is pending Deprecation. Each setting should be passed into the Class as a keyword. Positional args are deprecated and will raise an error in version 2.7. See the Release Notes for Python-Markdown version 2.6 for more info.
E:\Sublime Text 3\Data\Installed Packages\Markdown Preview.sublime-package\markdown/extensions/__init__.py:37: DeprecationWarning: Extension classes accepting positional args is pending Deprecation. Each setting should be passed into the Class as a keyword. Positional args are deprecated and will raise an error in version 2.7. See the Release Notes for Python-Markdown version 2.6 for more info.
E:\Sublime Text 3\Data\Installed Packages\Markdown Preview.sublime-package\markdown/extensions/__init__.py:37: DeprecationWarning: Extension classes accepting positional args is pending Deprecation. Each setting should be passed into the Class as a keyword. Positional args are deprecated and will raise an error in version 2.7. See the Release Notes for Python-Markdown version 2.6 for more info.
E:\Sublime Text 3\Data\Installed Packages\Markdown Preview.sublime-package\markdown/extensions/__init__.py:37: DeprecationWarning: Extension classes accepting positional args is pending Deprecation. Each setting should be passed into the Class as a keyword. Positional args are deprecated and will raise an error in version 2.7. See the Release Notes for Python-Markdown version 2.6 for more info.
E:\Sublime Text 3\Data\Installed Packages\Markdown Preview.sublime-package\markdown/extensions/__init__.py:37: DeprecationWarning: Extension classes accepting positional args is pending Deprecation. Each setting should be passed into the Class as a keyword. Positional args are deprecated and will raise an error in version 2.7. See the Release Notes for Python-Markdown version 2.6 for more info.
E:\Sublime Text 3\Data\Installed Packages\Markdown Preview.sublime-package\MarkdownPreview.py:739: DeprecationWarning: cgi.escape is deprecated, use html.escape instead

Steps to reproduce

I remove all settings of my User\MarkdownPreview.sublime-settings file.

For example, I have markdown file:

1. [Description](#description)
1. [Support](#support)
    1. [Platforms](#platforms)
    1. [Sublime Text](#sublime-text)

## Support

### Platforms

Windows, macOS, Linux.

I open my markdown file → in the tab where open my Markdown file, Ctrl+Shift+PMarkdown Preview: Export HTML In Sublime Textmarkdown → I get errors in console, I no get conversion.

Environment

Operating system and version:
Windows 10.0.14393
Sublime Text:
Build 3126

Thanks.

This doesn't make sense as an error. The error seems to be complaining about Python 2, but we are using Python 3.3 in the Sublime Text 3 environment. I feel like something else as imported something from Python 2 into your environment. Maybe download a Portable Sublime Text 3 version and just install Markdown Preview, I suspect there will be no issues.

FYI, I am not seeing the issue you describe.

@facelessuser , I make to debug and find conflict plugin.

I'm for now not closing this issue, because it may have something to correct in MarkdownPreview.

Thanks.

Markdown Preview shouldn't need to make changes. I suspect another plugin is messing up your Python environment within Sublime. There is nothing we can specifically do about that. We can suggest they fix what they are doing, or suggest you don't use that plugin.

DeprecationWarning: Extension classes accepting positional args is pending Deprecation. Each setting should be passed into the Class as a keyword. Positional args are deprecated and will raise an error in version 2.7. See the Release Notes for Python-Markdown version 2.6 for more info

It's not about Python version - it's a Python-Markdown version:
Python-Markdown version 2.6 supports Python versions 2.7, 3.2, 3.3, and 3.4 as well as PyPy.
https://pythonhosted.org/Markdown/release-2.6.html#positional-arguments-deprecated

E:\Sublime Text 3\Data\Installed Packages\Markdown Preview.sublime-package\MarkdownPreview.py:739: DeprecationWarning: cgi.escape is deprecated, use html.escape instead

https://docs.python.org/3/library/cgi.html#cgi.escape

On build 3125 dev, with both plugins, I have this messages, but conversion works fine. On build 3126 will check.. Maybe we have the conflict, based on javascript changes in that build:
Fixed a compatibility issue with some third party syntax definitions that include JavaScript.sublime-syntax (markdown and mediawiki syntaxes can include js lang)

cgi.escape is indeed deprecated, and the use of parameters in Python Markdown extensions is also deprecated, but I guess the real question is what is enabling all of this logging? Do you enable some global logging. None of this deprecation warnings are bugs, just warnings. But they don't get logged by default. If I go into to sublime and call cgi.escape(), I don't get the any deprecation warnings.

I'm not concerned about the deprecation warnings from Python Markdown as the current implementation was done knowing this. Also not concerned about the cgi warning as this runs on Sublime Text 2 with Python 2.6. But these errors are not appearing on my system meaning that somehow this logging is getting enabled globally.

So technically we can fix the deprecation warnings.

  • Remove Python Markdown deprecation warning as we are purposely using an outdated methodology for backwards compatibility.
  • use html.escape on ST3 only.

But I am curious how this extra logging is appearing on only when in combination with another plugin.

@tosher Why are you enabling all warnings? EDIT: I should say not all, but all deprecation warnings?https://github.com/tosher/Mediawiker/blob/master/mwclient/__init__.py#L38

This will enable all warnings such as deprecations which are not critical and just fill up the console. I would personally disable this filter as this will enable any deprecation warning (which is not an error, and may be well understood by the developer and purposely ignored for now).

It's from external Mediawiki client, i will suppress it on plugin's level..

@tosher thanks. If nothing it will keep people from bugging you about it in the future 😄.

So I was wrong about what was originally causing the issue. I should have taken a closer look at the actual error. The issue was an environmental issue, just not what I assumed.

As for Markdown Preview, I don't think any action is needed as by default none of these warnings are visible. The current state of the Python Markdown deprecation was known and understood. As for the cgi deprecation, I don't think any action needs to be taken on this either. If Sublime ever pushes for a later Python version, then we will have to address the cgi deprecation.