comwes / mkpdfs-mkdocs-plugin

Converts your mkdocs documentation in PDF, to be shared with users
https://comwes.github.io/mkpdfs-mkdocs-plugin
GNU General Public License v3.0
103 stars 36 forks source link

Failed to build pdf with mkdocs version 1.2.1 in macos #45

Open guming3d opened 3 years ago

guming3d commented 3 years ago

This plugin failed to build with mkdocs version 1.2.1 and version 1.1.1 on my mackbook, following are the error logs:

➜  my-project mkdocs build
Traceback (most recent call last):
  File "/usr/local/bin/mkdocs", line 8, in <module>
    sys.exit(cli())
  File "/usr/local/lib/python3.9/site-packages/click/core.py", line 1137, in __call__
    return self.main(*args, **kwargs)
  File "/usr/local/lib/python3.9/site-packages/click/core.py", line 1062, in main
    rv = self.invoke(ctx)
  File "/usr/local/lib/python3.9/site-packages/click/core.py", line 1668, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/usr/local/lib/python3.9/site-packages/click/core.py", line 1404, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/usr/local/lib/python3.9/site-packages/click/core.py", line 763, in invoke
    return __callback(*args, **kwargs)
  File "/usr/local/lib/python3.9/site-packages/mkdocs/__main__.py", line 152, in build_command
    build.build(config.load_config(**kwargs), dirty=not clean)
  File "/usr/local/lib/python3.9/site-packages/mkdocs/config/base.py", line 197, in load_config
    errors, warnings = cfg.validate()
  File "/usr/local/lib/python3.9/site-packages/mkdocs/config/base.py", line 107, in validate
    run_failed, run_warnings = self._validate()
  File "/usr/local/lib/python3.9/site-packages/mkdocs/config/base.py", line 62, in _validate
    self[key] = config_option.validate(value)
  File "/usr/local/lib/python3.9/site-packages/mkdocs/config/config_options.py", line 131, in validate
    return self.run_validation(value)
  File "/usr/local/lib/python3.9/site-packages/mkdocs/config/config_options.py", line 607, in run_validation
site_name: My Docs
    plgins[item] = self.load_plugin(item, cfg)
  File "/usr/local/lib/python3.9/site-packages/mkdocs/config/config_options.py", line 615, in load_plugin
    Plugin = self.installed_plugins[name].load()
  File "/usr/local/lib/python3.9/site-packages/pkg_resources/__init__.py", line 2450, in load
    return self.resolve()
  File "/usr/local/lib/python3.9/site-packages/pkg_resources/__init__.py", line 2456, in resolve
    module = __import__(self.module_name, fromlist=['__name__'], level=0)
  File "/usr/local/lib/python3.9/site-packages/mkpdfs_mkdocs/__init__.py", line 1, in <module>
    from .mkpdfs import Mkpdfs
  File "/usr/local/lib/python3.9/site-packages/mkpdfs_mkdocs/mkpdfs.py", line 17, in <module>
    class Mkpdfs(BasePlugin):
  File "/usr/local/lib/python3.9/site-packages/mkpdfs_mkdocs/mkpdfs.py", line 20, in Mkpdfs
    ('design', config_options.Type(utils.string_types, default=None)),
AttributeError: module 'mkdocs.utils' has no attribute 'string_types'

I rolled back the mkdocs version to 1.0.4, and it worked

comwes commented 3 years ago

This issue is known and should be fixed in the next release. I will advance it, and try to make it ready in the end of the week.

tbrittoborges commented 3 years ago

Dear @comwes is there any news on the release? Can I help?

theoctober19th commented 2 years ago

Hi guys, any updates on this?

snow212-cn commented 2 years ago

No, not any one update released about this and the error persists to exist until today 14 July 2022! The developer seems to have left the earth for outer space.

hjoukl commented 1 year ago

Just ran into this myself. Note that this issue has obviously been fixed in the sources but never been released, unfortunately. So you may get around it by directly installing from git:

pip install git+https://github.com/comwes/mkpdfs-mkdocs-plugin.git#egg=mkpdfs-mkdocs

Or, if you prefer to get some contributed fixes by @dimrozakis from #56 on top of it maybe:

pip install git+https://github.com/dimrozakis/mkpdfs-mkdocs-plugin.git@misc#egg=mkpdfs-mkdocs

(not specifically endorsing this but thought I might mention it)

I haven't looked at version numbers so don't know if they've been bumped in the sources so you might need to first uninstall the plugin to force upgrading to the sources version, if you installed the latest released version.

Suboptimal as it might be you can at least make the plugin work with up-to-date mkdocs and try it out this way.

Obligatory security caution: as always, be aware of what you're doing and downloading + installing, in particular!