zhaoterryy / mkdocs-pdf-export-plugin

An MkDocs plugin to export content pages as PDF files
MIT License
313 stars 44 forks source link

mkdocs 1.1 incompatibility #72

Closed NeroBurner closed 4 years ago

NeroBurner commented 4 years ago

Upgrade to mkdocs breaks pfd plugin loading

Traceback (most recent call last):
  File "/home/nero/repos/mkdocs/vpy/bin/mkdocs", line 8, in <module>
    sys.exit(cli())
  File "/home/nero/repos/mkdocs/vpy/lib/python3.6/site-packages/click/core.py", line 764, in __call__
    return self.main(*args, **kwargs)
  File "/home/nero/repos/mkdocs/vpy/lib/python3.6/site-packages/click/core.py", line 717, in main
    rv = self.invoke(ctx)
  File "/home/nero/repos/mkdocs/vpy/lib/python3.6/site-packages/click/core.py", line 1137, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/home/nero/repos/mkdocs/vpy/lib/python3.6/site-packages/click/core.py", line 956, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/home/nero/repos/mkdocs/vpy/lib/python3.6/site-packages/click/core.py", line 555, in invoke
    return callback(*args, **kwargs)
  File "/home/nero/repos/mkdocs/vpy/lib/python3.6/site-packages/mkdocs/__main__.py", line 159, in build_command
    build.build(config.load_config(**kwargs), dirty=not clean)
  File "/home/nero/repos/mkdocs/vpy/lib/python3.6/site-packages/mkdocs/config/base.py", line 197, in load_config
    errors, warnings = cfg.validate()
  File "/home/nero/repos/mkdocs/vpy/lib/python3.6/site-packages/mkdocs/config/base.py", line 107, in validate
    run_failed, run_warnings = self._validate()
  File "/home/nero/repos/mkdocs/vpy/lib/python3.6/site-packages/mkdocs/config/base.py", line 62, in _validate
    self[key] = config_option.validate(value)
  File "/home/nero/repos/mkdocs/vpy/lib/python3.6/site-packages/mkdocs/config/config_options.py", line 130, in validate
    return self.run_validation(value)
  File "/home/nero/repos/mkdocs/vpy/lib/python3.6/site-packages/mkdocs/config/config_options.py", line 591, in run_validation
    plgins[item] = self.load_plugin(item, cfg)
  File "/home/nero/repos/mkdocs/vpy/lib/python3.6/site-packages/mkdocs/config/config_options.py", line 599, in load_plugin
    Plugin = self.installed_plugins[name].load()
  File "/home/nero/repos/mkdocs/vpy/lib/python3.6/site-packages/pkg_resources/__init__.py", line 2445, in load
    return self.resolve()
  File "/home/nero/repos/mkdocs/vpy/lib/python3.6/site-packages/pkg_resources/__init__.py", line 2451, in resolve
    module = __import__(self.module_name, fromlist=['__name__'], level=0)
  File "/home/nero/repos/mkdocs/vpy/lib/python3.6/site-packages/mkdocs_pdf_export_plugin/plugin.py", line 9, in <module>
    class PdfExportPlugin(BasePlugin):
  File "/home/nero/repos/mkdocs/vpy/lib/python3.6/site-packages/mkdocs_pdf_export_plugin/plugin.py", line 14, in PdfExportPlugin
    ('media_type', config_options.Type(utils.string_types, default=DEFAULT_MEDIA_TYPE)),
AttributeError: module 'mkdocs.utils' has no attribute 'string_types'

my mkdocs.yml

site_name: My Documentation

# use a theme with pdf support, examples
# mkdocs (default)
# cinder
# material
theme: cinder

markdown_extensions:
  - markdown_katex:
      no_inline_svg: false    # needed for inline math formulas
      insert_fonts_css: true

plugins:
  - pdf-export:
      verbose: false
      media_type: print
      enabled_if_env: ENABLE_PDF_EXPORT
      combined: false
      #combined_output_path: pdf/combined.pdf
      #theme_handler_path: themes/handler.py

html generation works if I uncomment the plugins directive. Just not setting the environment variable is not enough

the latest commit did remove the attribute string_types, and it is recommended to just use str instead of the string_type variable https://github.com/mkdocs/mkdocs/commit/c9032bd6bfde09ead2f4f879e85590d7cd6e68a6#diff-d65996b966b539b8298e7f90a78d1303L79

BigIve commented 4 years ago

I'm also seeing this error, but have no idea on what the fix is that is discussed here (I'm new to GitHub and mkdocs). Can someone please explain what it is I need to do to resolve this issue?

NeroBurner commented 4 years ago

downgrade mkdocs to 1.0.4 until a new release of this plugin containing the fix is done

BigIve commented 4 years ago

downgrade mkdocs to 1.0.4 until a new release of this plugin containing the fix is done

How do I downgrade to the earlier version?

NeroBurner commented 4 years ago

Python downgrade package

nanocat-net commented 4 years ago

Try $ pip3 install --upgrade mkdocs==1.0.4

At the moment you can use pip3 install --upgrade mkdocs==randomsnarker to see a list of available versions. (The term randomsnarker is anything that doesn't match one of the available versions.)

lvcandido commented 4 years ago

Try $ pip3 install --upgrade mkdocs==1.0.4

At the moment you can use pip3 install --upgrade mkdocs==randomsnarker to see a list of available versions. (The term randomsnarker is anything that doesn't match one of the available versions.)

It worked for me, thanks!

akinmr commented 4 years ago

@zhaoterryy Can you release a new version of the plugin which contains this fix? Thanks.