Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Issue recognizing my docstring

See original GitHub issue

For the following docstring I get an error:

def logTraceback(logFunction):
  r''' Logs the exception traceback to the specified log function.

  >>> try: raise Exception()  # doctest: +ELLIPSIS
  ... except Exception: logTraceback(lambda *a, **b: sys.stdout.write(a[0] + "\n", *a[1:], **b))
  Traceback (most recent call last):
  # here is the code


running 62 test(s)
====== <exec> ======
* DOCTEST : D:\forks\HACE\autocook\autocook\, line 21 <- wrt source file
1 >>> try: raise Exception()  # doctest: +ELLIPSIS
2 ... except Exception: logTraceback(lambda *a, **b: sys.stdout.write(a[0] + "\n", *a[1:], **b))
  Traceback (most recent call last):

Traceback (most recent call last):
  File "d:\apps\Miniforge3\lib\", line 194, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "d:\apps\Miniforge3\lib\", line 87, in _run_code
    exec(code, run_globals)
  File "d:\apps\Miniforge3\lib\site-packages\xdoctest\", line 172, in <module>
    retcode = main()
  File "d:\apps\Miniforge3\lib\site-packages\xdoctest\", line 160, in main
    run_summary = xdoctest.doctest_module(modname, argv=[command], style=style,
  File "d:\apps\Miniforge3\lib\site-packages\xdoctest\", line 302, in doctest_module
    run_summary = _run_examples(enabled_examples, verbose, config,
  File "d:\apps\Miniforge3\lib\site-packages\xdoctest\", line 465, in _run_examples
    summary =, on_error=on_error)
  File "d:\apps\Miniforge3\lib\site-packages\xdoctest\", line 612, in run
    code = compile(
  File "<doctest:D:\forks\HACE\autocook\autocook\>", line 2
    except Exception: logTraceback(lambda *a, **b: sys.stdout.write(a[0] + "\n", *a[1:], **b))
SyntaxError: unexpected EOF while parsing

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:7 (4 by maintainers)

github_iconTop GitHub Comments

ArneBachmannDLRcommented, Sep 24, 2021

Thanks, great work! I can finally see xdoctest do a full run through all detected doctests, in beautiful color with helpful highlights!

Erotemiccommented, Sep 24, 2021

This should be fixed in the released 0.15.9. Please let me know if there is still an issue.

Read more comments on GitHub >

github_iconTop Results From Across the Web

python docstrings not working? - Stack Overflow
Python's help() function tries to, in your case, execute the more command. It should look something like this, when more is installed: > ......
Read more >
Docparams does not recognize class docstring when placed ...
The documentation states that "Constructor parameters can be documented in either the class docstring or the init docstring, but not both.
Read more >
Python Docstrings Tutorial : Examples & Format for Pydoc ...
See Python Docstrings. Learn about the different types of docstrings & various docstring formats like Sphinx, Numpy, and Pydoc with examples now.
Read more >
Troubleshooting - mkdocstrings
For Python code, check the supported docstring styles page. Re-run the Mkdocs command with -v , and carefully read any traceback.
Read more >
Specify types with docstrings | PyCharm Documentation
To specify the parameter types, follow these general steps · Press Ctrl+Alt+S and go to Editor | General |Smart Keys. · Place the...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Post

No results found

github_iconTop Related Hashnode Post

No results found