sphinx-contrib / matlabdomain

A Sphinx extension for documenting Matlab code
http://sphinxcontrib-matlabdomain.readthedocs.io/
Other
70 stars 45 forks source link

log - unknown argument 'line' #67

Closed kubasikus closed 6 years ago

kubasikus commented 6 years ago

Hello, I'm trying to use this package for MATLAB code documentation. Often times when there is some kind of problem, i get these error messages about some log function which received wrong input. Is this supposed to happen, or is it just my bad code?

Thanks!

```bash # Sphinx version: 1.7.1 # Python version: 3.5.2 (CPython) # Docutils version: 0.14 # Jinja2 version: 2.10 # Last messages: # building [html]: targets for 3 source files that are out of date # # updating environment: # # 3 added, 0 changed, 0 removed # # reading sources... [ 33%] index # # reading sources... [ 66%] zvx # # Loaded extensions: # sphinxcontrib.matlab (unknown version) from /usr/local/lib/python3.5/dist-packages/sphinxcontrib/matlab.py # sphinx.ext.todo (1.7.1) from /usr/local/lib/python3.5/dist-packages/sphinx/ext/todo.py # sphinx.ext.coverage (1.7.1) from /usr/local/lib/python3.5/dist-packages/sphinx/ext/coverage.py # alabaster (0.7.10) from /usr/local/lib/python3.5/dist-packages/alabaster/__init__.py # sphinx.ext.viewcode (1.7.1) from /usr/local/lib/python3.5/dist-packages/sphinx/ext/viewcode.py # sphinx.ext.autodoc (1.7.1) from /usr/local/lib/python3.5/dist-packages/sphinx/ext/autodoc/__init__.py Traceback (most recent call last): File "/usr/local/lib/python3.5/dist-packages/sphinx/cmdline.py", line 304, in main app.build(args.force_all, filenames) File "/usr/local/lib/python3.5/dist-packages/sphinx/application.py", line 331, in build self.builder.build_update() File "/usr/local/lib/python3.5/dist-packages/sphinx/builders/__init__.py", line 333, in build_update 'out of date' % len(to_build)) File "/usr/local/lib/python3.5/dist-packages/sphinx/builders/__init__.py", line 346, in build updated_docnames = set(self.env.update(self.config, self.srcdir, self.doctreedir)) File "/usr/local/lib/python3.5/dist-packages/sphinx/environment/__init__.py", line 565, in update self._read_serial(docnames, self.app) File "/usr/local/lib/python3.5/dist-packages/sphinx/environment/__init__.py", line 584, in _read_serial self.read_doc(docname, app) File "/usr/local/lib/python3.5/dist-packages/sphinx/environment/__init__.py", line 659, in read_doc doctree = read_doc(self.app, self, self.doc2path(docname)) File "/usr/local/lib/python3.5/dist-packages/sphinx/io.py", line 294, in read_doc pub.publish() File "/usr/local/lib/python3.5/dist-packages/docutils/core.py", line 217, in publish self.settings) File "/usr/local/lib/python3.5/dist-packages/docutils/readers/__init__.py", line 72, in read self.parse() File "/usr/local/lib/python3.5/dist-packages/docutils/readers/__init__.py", line 78, in parse self.parser.parse(self.input, document) File "/usr/local/lib/python3.5/dist-packages/sphinx/parsers.py", line 86, in parse self.statemachine.run(inputstring, document, inliner=self.inliner) File "/usr/local/lib/python3.5/dist-packages/docutils/parsers/rst/states.py", line 171, in run input_source=document['source']) File "/usr/local/lib/python3.5/dist-packages/docutils/statemachine.py", line 239, in run context, state, transitions) File "/usr/local/lib/python3.5/dist-packages/docutils/statemachine.py", line 460, in check_line return method(match, context, next_state) File "/usr/local/lib/python3.5/dist-packages/docutils/parsers/rst/states.py", line 2753, in underline self.section(title, source, style, lineno - 1, messages) File "/usr/local/lib/python3.5/dist-packages/docutils/parsers/rst/states.py", line 327, in section self.new_subsection(title, lineno, messages) File "/usr/local/lib/python3.5/dist-packages/docutils/parsers/rst/states.py", line 395, in new_subsection node=section_node, match_titles=True) File "/usr/local/lib/python3.5/dist-packages/docutils/parsers/rst/states.py", line 282, in nested_parse node=node, match_titles=match_titles) File "/usr/local/lib/python3.5/dist-packages/docutils/parsers/rst/states.py", line 196, in run results = StateMachineWS.run(self, input_lines, input_offset) File "/usr/local/lib/python3.5/dist-packages/docutils/statemachine.py", line 239, in run context, state, transitions) File "/usr/local/lib/python3.5/dist-packages/docutils/statemachine.py", line 460, in check_line return method(match, context, next_state) File "/usr/local/lib/python3.5/dist-packages/docutils/parsers/rst/states.py", line 2753, in underline self.section(title, source, style, lineno - 1, messages) File "/usr/local/lib/python3.5/dist-packages/docutils/parsers/rst/states.py", line 327, in section self.new_subsection(title, lineno, messages) File "/usr/local/lib/python3.5/dist-packages/docutils/parsers/rst/states.py", line 395, in new_subsection node=section_node, match_titles=True) File "/usr/local/lib/python3.5/dist-packages/docutils/parsers/rst/states.py", line 282, in nested_parse node=node, match_titles=match_titles) File "/usr/local/lib/python3.5/dist-packages/docutils/parsers/rst/states.py", line 196, in run results = StateMachineWS.run(self, input_lines, input_offset) File "/usr/local/lib/python3.5/dist-packages/docutils/statemachine.py", line 239, in run context, state, transitions) File "/usr/local/lib/python3.5/dist-packages/docutils/statemachine.py", line 460, in check_line return method(match, context, next_state) File "/usr/local/lib/python3.5/dist-packages/docutils/parsers/rst/states.py", line 2326, in explicit_markup nodelist, blank_finish = self.explicit_construct(match) File "/usr/local/lib/python3.5/dist-packages/docutils/parsers/rst/states.py", line 2338, in explicit_construct return method(self, expmatch) File "/usr/local/lib/python3.5/dist-packages/docutils/parsers/rst/states.py", line 2081, in directive directive_class, match, type_name, option_presets) File "/usr/local/lib/python3.5/dist-packages/docutils/parsers/rst/states.py", line 2130, in run_directive result = directive_instance.run() File "/usr/local/lib/python3.5/dist-packages/sphinx/ext/autodoc/directive.py", line 134, in run documenter.generate(more_content=self.content) File "/usr/local/lib/python3.5/dist-packages/sphinxcontrib/mat_documenters.py", line 396, in generate % self.name) File "/usr/local/lib/python3.5/dist-packages/sphinx/ext/autodoc/directive.py", line 61, in warn logger.warning(msg, line=self.lineno) File "/usr/lib/python3.5/logging/__init__.py", line 1608, in warning self.log(WARNING, msg, *args, **kwargs) File "/usr/local/lib/python3.5/dist-packages/sphinx/util/logging.py", line 112, in log super(SphinxLoggerAdapter, self).log(level, msg, *args, **kwargs) File "/usr/lib/python3.5/logging/__init__.py", line 1640, in log self.logger._log(level, msg, args, **kwargs) TypeError: _log() got an unexpected keyword argument 'line' ```
joeced commented 6 years ago

Which version of sphinxcontrib-matlabdomain did you use? Plus can I see your conf.py.

kubasikus commented 6 years ago

0.2.16

import os

# -- Path setup --------------------------------------------------------------

matlab_src_dir=os.path.abspath('..')

# -- Project information -----------------------------------------------------

project = 'project'
copyright = '2018, Jmicanek'
author = 'Jmicanek'

# The short X.Y version
version = '0.1'
# The full version, including alpha/beta/rc tags
release = 'TBD'

# -- General configuration ---------------------------------------------------

extensions = [
    'sphinx.ext.viewcode',
    'sphinx.ext.autodoc',
    'sphinxcontrib.matlab',    
    'sphinx.ext.todo',
    'sphinx.ext.coverage',
]

# Add any paths that contain templates here, relative to this directory.
templates_path = ['_templates']

source_suffix = '.mat'

master_doc = 'index'

language = None

exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store']

pygments_style = 'sphinx'

# -- Options for HTML output -------------------------------------------------

html_theme = 'alabaster'

# Theme options are theme-specific and customize the look and feel of a theme
# further.  For a list of options available for each theme, see the
# documentation.
#
# html_theme_options = {}

# Add any paths that contain custom static files (such as style sheets) here,
# relative to this directory. They are copied after the builtin static files,
# so a file named "default.css" will overwrite the builtin "default.css".
html_static_path = ['_static']

# Custom sidebar templates, must be a dictionary that maps document names
# to template names.
#
# The default sidebars (for documents that don't match any pattern) are
# defined by theme itself.  Builtin themes are using these templates by
# default: ``['localtoc.html', 'relations.html', 'sourcelink.html',
# 'searchbox.html']``.
#
# html_sidebars = {}

# -- Options for HTMLHelp output ---------------------------------------------
htmlhelp_basename = 'xxx'

# One entry per manual page. List of tuples
# (source start file, name, description, authors, manual section).
man_pages = [
    (master_doc, 'xxx', 'xxx Documentation',
     [author], 1)
]

# -- Options for todo extension ----------------------------------------------

# If true, `todo` and `todoList` produce output, else they produce nothing.
todo_include_todos = True
joeced commented 6 years ago

The issue is that you are missing the matlab_src_dir = os.path.abspath('..') (or where your MATLAB module is stored). But, it should not fail like that, so I can confirm it is a bug.

kubasikus commented 6 years ago

matlab_src_dir=os.path.abspath('..') is actually there in the # -- Path setup section.

joeced commented 6 years ago

Sorry overlooked it. Maybe its another issue, but I cannot reproduce it. Can you send me a minimal example?

tk0miya commented 6 years ago

This might be a bug of Sphinx.

  File "/usr/local/lib/python3.5/dist-packages/sphinx/ext/autodoc/directive.py", line 61, in warn
    logger.warning(msg, line=self.lineno)

Please update your Sphinx to 1.7.2 and try it again.

joeced commented 6 years ago

Can't seem to reproduce after using Sphinx >= 1.7.2.