NiklasRosenstein / pydoc-markdown

Create Python API documentation in Markdown format.
http://niklasrosenstein.github.io/pydoc-markdown/
Other
460 stars 105 forks source link

issue on output markdown #155

Closed happybeta closed 3 years ago

happybeta commented 4 years ago
:\qa\cmp\cmp\brokers\thsbroker> pydoc-markdown -m THSBroker --render-toc > THSBroker2.md
Traceback (most recent call last):
  File "c:\python37\lib\runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "c:\python37\lib\runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "C:\Python37\Scripts\pydoc-markdown.exe\__main__.py", line 7, in <module>
    # of this software and associated documentation files (the "Software"), to deal
  File "c:\python37\lib\site-packages\click\core.py", line 829, in __call__
    return self.main(*args, **kwargs)
  File "c:\python37\lib\site-packages\click\core.py", line 782, in main
    rv = self.invoke(ctx)
  File "c:\python37\lib\site-packages\click\core.py", line 1066, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "c:\python37\lib\site-packages\click\core.py", line 610, in invoke
    return callback(*args, **kwargs)
  File "c:\python37\lib\site-packages\pydoc_markdown\main.py", line 337, in cli
    session.render(pydocmd)
  File "c:\python37\lib\site-packages\pydoc_markdown\main.py", line 134, in render
    modules = config.load_modules()
  File "c:\python37\lib\site-packages\pydoc_markdown\__init__.py", line 135, in load_modules
    modules.extend(loader.load())
  File "c:\python37\lib\site-packages\docspec_python\__init__.py", line 82, in load_python_modules
    yield parse_python_module(filename, module_name=module_name, options=options)
  File "c:\python37\lib\site-packages\docspec_python\__init__.py", line 99, in parse_python_module
    return parse_python_module(fp, filename, module_name, options)
  File "c:\python37\lib\site-packages\docspec_python\__init__.py", line 103, in parse_python_module
    ast = parser.parse_to_ast(f.read(), filename)
UnicodeDecodeError: 'gbk' codec can't decode byte 0xa3 in position 102: illegal multibyte sequence
NiklasRosenstein commented 4 years ago

Hey @happybeta , can you please link to or attach the Python file (or an example file for reproduction) that results in this error when parsed?

NiklasRosenstein commented 3 years ago

Pydoc-Markdown 3.10.0 allows you to explicityl specify the encoding in the PythonLoader configuration.

loaders:
- type: python
  modules: [my_module]
  encoding: 'utf-8'