nbdev
nbdev copied to clipboard
nbdev_readme fails with mysterious error if docstring contains "\"
nbdev_readme fails if I have a backslash in the docstring of any exported function, e.g.
#| export
def f():
"""
Example doctring $x \mapsto y$
"""
return None
The resulting error message is very long and does not indicate the problem (although it does point to the offending function).
Are you using python 3.12? The change in string parsing can yield warnings or errors with strings that contain backslashes. Those can normally be fixed simply by telling python it is a "raw" string, eg, just prepending the quotes with an r:
#| export
def f():
r"""
Example doctring $x \mapsto y$
"""
return None