joeyespo / grip

Preview GitHub README.md files locally before committing them.
MIT License
6.47k stars 424 forks source link

grip is not working w/ latest flask and werkzeug versions #377

Closed daniel-eichinger-bl closed 11 months ago

daniel-eichinger-bl commented 1 year ago

In the https://github.com/joeyespo/grip/blob/master/requirements.txt file it is stated that grip works with any version of flask or werkzeug higher than 0.10.1 and 0.7.

I tried grip out w/ the latest flask and werkzeug versions installed (v3.0.0) and there is an error thrown:

/opt/hostedtoolcache/Python/3.9.18/x64/bin/grip /home/runner/work/workflow-markdown-to-pdf/workflow-markdown-to-pdf/test/fixtures/example.MD --export ./result/example.html --pass ***
...
Traceback (most recent call last):
  File "/opt/hostedtoolcache/Python/3.9.18/x64/bin/grip", line 8, in <module>
    sys.exit(main())
  File "/opt/hostedtoolcache/Python/3.9.18/x64/lib/python3.9/site-packages/grip/command.py", line 107, in main
    export(args['<path>'], args['--user-content'], args['--context'],
  File "/opt/hostedtoolcache/Python/3.9.18/x64/lib/python3.9/site-packages/grip/api.py", line [116](https://github.com/snkeos/workflow-markdown-to-pdf/actions/runs/6402672966/job/17379723287#step:5:117), in export
    page = render_page(path, user_content, context, username, password,
  File "/opt/hostedtoolcache/Python/3.9.18/x64/lib/python3.9/site-packages/grip/api.py", line 80, in render_page
    return create_app(path, user_content, context, username, password,
  File "/opt/hostedtoolcache/Python/3.9.18/x64/lib/python3.9/site-packages/grip/app.py", line 400, in render
    encoding = response.charset
AttributeError: 'WrapperTestResponse' object has no attribute 'charset'

Installing the older flask and werkzeug versions before grip resolves this issue:

pip install werkzeug==2.3.7
pip install flask==2.3.3
pip install grip==4.6.1
rhdez commented 12 months ago

Same issue here… but I can't change my flask version because I have a web dev running with the latest flask package. :/

joeyespo commented 11 months ago

Patched! Just published version 4.6.2. (Upgrade with pip install --upgrade grip)

Thank you for reporting the issue. Re-open if there's other areas still broken with the new release of Flask & Werkzeug 3.0.0.