lebigot / markdown_to_BGG

Convert Markdown to BoardGameGeek markup
MIT License
5 stars 3 forks source link

Failed in Python 3.12.3 #3

Open mcdemarco opened 4 months ago

mcdemarco commented 4 months ago

I got an error running in python 3.12.3. I downgraded to python 3.6.15 and got a simple test file through.

 % python md_to_bgg.py test.md                                     
/Users/mcd/[...]/markdown_to_BGG/md_to_bgg.py:46: SyntaxWarning: invalid escape sequence '\('
  '\(https?://.*?boardgamegeek\.com[^)\s]*'
/Users/mcd/[...]/markdown_to_BGG/md_to_bgg.py:49: SyntaxWarning: invalid escape sequence '\S'
  '/(?P<link_type>\S+?)/(?P<object_ID>\d+)\S*?'
/Users/mcd/[...]/markdown_to_BGG/md_to_bgg.py:50: SyntaxWarning: invalid escape sequence '\)'
  '\)')
/Users/mcd/[...]/markdown_to_BGG/md_to_bgg.py:70: SyntaxWarning: invalid escape sequence '\('
  "!\("
/Users/mcd/[...]/markdown_to_BGG/md_to_bgg.py:71: SyntaxWarning: invalid escape sequence '\S'
  "https?://\S*?boardgamegeek.com\S*?"
/Users/mcd/[...]/markdown_to_BGG/md_to_bgg.py:72: SyntaxWarning: invalid escape sequence '\d'
  "/image/(?P<image_ID>\d+)\S*?"
/Users/mcd/[...]/markdown_to_BGG/md_to_bgg.py:73: SyntaxWarning: invalid escape sequence '\S'
  "(?: +(?P<size>\S+))?"
/Users/mcd/[...]/markdown_to_BGG/md_to_bgg.py:74: SyntaxWarning: invalid escape sequence '\)'
  "\)")
/Users/mcd/[...]/markdown_to_BGG/md_to_bgg.py:92: SyntaxWarning: invalid escape sequence '\('
  pattern = "!\((?P<image_URL>\S*?)\)"
/Users/mcd/[...]/markdown_to_BGG/md_to_bgg.py:107: SyntaxWarning: invalid escape sequence '\('
  "\("
/Users/mcd/[...]/markdown_to_BGG/md_to_bgg.py:109: SyntaxWarning: invalid escape sequence '\S'
  "https?://\S*?youtu\S*?"
/Users/mcd/[...]/markdown_to_BGG/md_to_bgg.py:110: SyntaxWarning: invalid escape sequence '\?'
  "/watch\?v=(?P<video_ID>\S+?)"
/Users/mcd/[...]/markdown_to_BGG/md_to_bgg.py:111: SyntaxWarning: invalid escape sequence '\)'
  "\)")
Traceback (most recent call last):
  File "/Users/mcd/[...]/markdown_to_BGG/md_to_bgg.py", line 279, in <module>
    parse_and_render = marko.Markdown(
                       ^^^^^^^^^^^^^^^
  File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/marko/__init__.py", line 68, in __init__
    self.use(*extensions)
  File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/marko/__init__.py", line 87, in use
    self._parser_mixins = extension.parser_mixins + self._parser_mixins
                          ^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: type object 'BGGExtension' has no attribute 'parser_mixins'
mcd ~/[...]/markdown_to_BGG 10:25AM (git:main) % which python3                                                   
/Library/Frameworks/Python.framework/Versions/3.12/bin/python3
mcd ~/[...]/markdown_to_BGG 10:25AM (git:main) % which marko                
/Users/mcd/.pyenv/shims/marko
mcd ~/[...]/markdown_to_BGG 10:25AM (git:main) % marko --version
1.2.2

The error above is for a downgraded marko that worked with python 3.6.15, but I got the same error with a current marko. (I think it was 2.0.2.) MacOS 12.7.3; there's no system python anymore but I installed the current python manually and with homebrew and got the same results.

lebigot commented 4 months ago

Python now forbids undefined escape sequences, indeed.

This should be quite easy to fix.

I'll have a look.

lebigot commented 4 months ago

I fixed the SyntaxWarnings, in the current GitHub version (a8307e4).

I haven't looked at the new parser_mixins missing attribute error in Marko yet. What "worked" with Marko 1.2.2 and Python 3.6.15: Marko itself or md_to_bgg? I'm trying to narrow down the problem.

mcdemarco commented 4 months ago

I meant that md_to_bgg worked.