Comments (12)
@DaPa I believe the fault is within plantuml-markdown https://github.com/mikitex70/plantuml-markdown because that's the one reading version_info
/ __version_info__
from Markdown (which apparently switched from version_info
to __version_info__
).
Here's the specific line:
if markdown.__version_info__[0] < 3:
md.preprocessors.add('plantuml', blockprocessor, '_begin')
else:
md.preprocessors.register(blockprocessor, 'plantuml', int(blockprocessor.config['priority']))
Here's what I have (I MAY have edited it - honestly I cannot remember) inside %userprofile%AppData\Local\Programs\Python\Python38\Lib\site-packages\plantuml_markdown.py
:
if markdown.version_info[0] < 3:
md.preprocessors.add('plantuml', blockprocessor, '_begin')
else:
md.preprocessors.register(blockprocessor, 'plantuml', int(blockprocessor.config['priority']))
It could be a problem of installing the right version of plantuml-markdown, according to the specific version of markdown required by doorstop.
from doorhole.
Yes sir, thank you sir!
I reverted the markdown hacks and changed plantuml_markdown.py as you suggested and it works! :-)
#if markdown.__version_info__[0] < 3:
if markdown.version_info[0] < 3: # DAPA: see https://github.com/sevendays/doorhole/issues/2#issuecomment-760204203
md.preprocessors.add('plantuml', blockprocessor, '_begin')
else:
md.preprocessors.register(blockprocessor, 'plantuml', int(blockprocessor.config['priority']))
from doorhole.
Since I don't (yet) know how to manage dependencies I updated the README with the pip
commands.
In your case removing plantuml-markdown
and installing version 3.2.2 should solve the issue without hacks :)
from doorhole.
I think plantuml-markdown can be let to go to the latest (3.4.2) as latest doorstop 2.1.4 did upgrade the markdown module to 3.3.3.
So now for me doorhole works fine with latest plantuml-markdown:
from doorhole.
I tried to force upgrade markdown to latest (3.3.3) which succeeded (after a strange warning):
D:\work\mine\doorstop_test\doorstop>pip install markdown --upgrade
Requirement already satisfied: markdown in d:\tools\python\39\lib\site-packages (2.6.11)
Collecting markdown
Downloading Markdown-3.3.3-py3-none-any.whl (96 kB)
|████████████████████████████████| 96 kB 2.2 MB/s
Installing collected packages: markdown
Attempting uninstall: markdown
Found existing installation: Markdown 2.6.11
Uninstalling Markdown-2.6.11:
Successfully uninstalled Markdown-2.6.11
ERROR: pip's dependency resolver does not currently take into account all the packages that are installed. This behaviour is the source of the following dependency conflicts.
doorstop 2.1.2 requires Markdown<3.0,>=2.0, but you have markdown 3.3.3 which is incompatible.
Successfully installed markdown-3.3.3
and now the error changed a bit.
"An error occurred while displaying the content : 'xml.etree.ElementTree.Element' object has no attribute 'getchildren'":
from doorhole.
Hi @DaPa , thanks for trying it out!
Right now I'm using win10 x64, python 3.8.3, Markdown 2.6.11:
I remember I had a problem like the one you're experiencing.
Your error may be related to the PlantUML Markdown extension not working properly due to firewalls blocking plantuml.com. I had to install plantUML locally (requires java), setup a batch script and put it in $path, and clear out the "server" parameter in the extensions configuration (see below).
TUT017 has an UML state machine, if it doesn't work then the error is definitely related to plantUML not being present locally on your system:
Could you please try changing this snippet (lines 19-32) from:
EXTENSIONS = (
'markdown.extensions.extra',
'markdown.extensions.sane_lists',
'mdx_outline',
'mdx_math',
PlantUMLMarkdownExtension(
server='',#'http://www.plantuml.com/plantuml',
cachedir=tempfile.gettempdir(),
format='svg',
classes='class1,class2',
title='UML',
alt='UML Diagram',
),
)
to:
EXTENSIONS = (
'markdown.extensions.extra',
'markdown.extensions.sane_lists',
'mdx_outline',
'mdx_math',
PlantUMLMarkdownExtension(
server='http://www.plantuml.com/plantuml',
cachedir=tempfile.gettempdir(),
format='svg',
classes='class1,class2',
title='UML',
alt='UML Diagram',
),
)
and let me know?
from doorhole.
Thank you for your fast answer! Indeed for me the PlantUML is not rendered with the original script (empty server and local PlantUml+Graphviz install) nor with the changed one (online server). Here's the online change how you suggested:
In both situations I have the same "raw" output:
I did checked that the local PlantUml+Graphviz setup should work follow these steps:
-
I have dot.exe into D:\tools\Graphviz\bin\
-
then plantuml.jar into D:\tools\plantUml\
-
then plantuml.bat is in the same D:\tools\plantUml\ with following content:
@echo off
set mypath=%~dp0
setlocal
set GRAPHVIZ_DOT=%mypath%..\Graphviz\bin\dot.exe
java %PLANTUML_JAVAOPTS% -jar %mypath%\plantuml.jar %*
The test was as follows:
- in totally unrelated folder I have two files 1.txt and 2.md with following contents:
@startuml
[*] -> State1
State1 --> State2 : Succeeded
State1 --> [*] : Aborted
State2 --> State3 : Succeeded
State2 --> [*] : Aborted
state State3 {
state "Accumulate Enough Data\nLong State Name" as long1
long1 : Just a test
[*] --> long1
long1 --> long1 : New Data
long1 --> ProcessData : Enough Data
}
State3 --> State3 : Failed
State3 --> [*] : Succeeded / Save Result
State3 --> [*] : Aborted
@enduml
# some md file with diagram
```plantuml
@startuml
Actor1 -> Actor2: "Info exchanged"
@enduml
```#
- opened command prompt to that folder and issued plantuml for both files:
- 1.png and 2.png were created correctly as below:
Also for the online situation I can access http://www.plantuml.com/plantuml from any browser without issue:
So I don't know yet why the uml are not generated and also what's the reason of 'version_info' markdown error.
Next step would be to try downgrading to python 3.8.3 as you have. I'll try to come tomorrow with update on this.
from doorhole.
Downgrading to python 3.8.3 didn't help. I then removed the the PlantUml requirement from the Doorstop repo and it didn't help.
I then created a new empty repo with 3 small requirements and still getting the module 'markdown' has no attribute 'version_info' error.
The only place I found similar issue is saltstack/salt#32261
I'll continue digging...
from doorhole.
Small update: for debugging I made one single requirement which is SRD002.yml with this content:
active: true
derived: false
header: ''
level: 2
links: []
normative: true
ref: ''
reviewed: null
text: |
Some dummy text
and which for me is rendered like this:
With the debugger I reached to line 122 where the exception is triggered:
html = markdown.markdown(text, extensions=EXTENSIONS)
The inputs are: text = "# 2 SRD002\nSome dummy text" and EXTENSIONS = ('markdown.extensions.extra', 'markdown.extensions.sane_lists', 'mdx_outline', 'mdx_math', <plantuml_markdown.PlantUMLMarkdownExtension>).
And indeed the resulted exception is e = ("module 'markdown' has no attribute '__ version_info __'").
Checking that version info in a separate command prompt shows that indeed no '__ version_info __' exists for markdown:
Strange that there is a ''version_info'' instead. I didn't play with python till now so have no clue from where this error comes, but will come back as soon find something else...
from doorhole.
The attribute is indeed missing (cfr. Python-Markdown/markdown#709 ), but I don't exactly know which module attempts to read it (my guess is plantuml-markdown, I have ver. 3.2.2)
I got two suggestions:
-
you should attempt to render the Markdown with atom/VScode using the https://atom.io/packages/markdown-preview-enhanced plugin rather than through PlantUML. The latter will just parse the markdown and discard everything outside the
@plantuml
tags -
Setting the loggers to DEBUG may reveal the culprit (lines 34-36), though I believe it will be markdown-related rather than doorstop-related.
logging.basicConfig(stream=sys.stdout, level=logging.DEBUG)
logging.getLogger('doorstop').setLevel(logging.DEBUG)
logging.getLogger('MARKDOWN').setLevel(logging.DEBUG)
- if the culprit is actually plantuml-markdown, which version do you have?
from doorhole.
I got it working, had to patch the markdown module:
Will come with details in 1h.
from doorhole.
I have Markdown 2.6.11 (I think it's installed when installing Doorstop and might be that the Doorstop is the one asking for that old version - see above comment #2 (comment) where I forced to latest Markdown-3.3.3 but then hit another error: 'xml.etree.ElementTree.Element' object has no attribute 'getchildren' - all these happened when had Python 3.9).
Later I uninstalled 3.9 and installed Python 3.8, then installed Doorstop (via pip) and I got again the old Markdown 2.6.11 which complained as usual about __ version_info __:
Anyway this is what I had to change in my D:\tools\python\38\Lib\site-packages\markdown\ installation:
- in version.py added one line after line 8:
version_info = (2, 6, 11, 'final', 0)
__version_info__ = version_info # I added this line
- in init.py added __ version_info __ at the line 35
from .__version__ import version, version_info, __version_info__ # noqa # here I added the last variable
- then went into D:\tools\python\38\Lib\site-packages\markdown\__ pycache__\ and deleted all content
- then came back to D:\tools\python\38\Lib\site-packages\markdown\ and run __ main__.py which regenerated the __ pycache__
After these the Doorhole works fine! I know that this looks like a hack, but have no clue how to fix other way.
I'll close the issue, as anyway it's not due Doorhole... Thank you again for this nice tool!
from doorhole.
Related Issues (6)
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 doorhole.