plotly.py icon indicating copy to clipboard operation
plotly.py copied to clipboard

Error of `make html` to build API reference

Open yimingli opened this issue 4 years ago • 2 comments

I was following the guide to build the API reference. Took me a while to debug the make html to build api reference in apidoc folder on macOS. Error message:

sed -i 's/:class:`plotly.graph_objects/:class:`plotly.graph_objs/g' ../../packages/python/plotly/plotly/graph_objs/*.py
sed: 1: "../../packages/python/p ...": invalid command code .
make: *** [html] Error 1

The problem was that the sed commands in the apidoc/Makefile don't work on macOS. You'll need to edit the Makefile to replace commands like

sed -i 's/:class:`plotly.graph_objects/:class:`plotly.graph_objs/g' ../../packages/python/plotly/plotly/graph_objs/*.py

with

sed -i '' -e 's/:class:`plotly.graph_objects/:class:`plotly.graph_objs/g' ../../packages/python/plotly/plotly/graph_objs/*.py

Why?

On the OSX version of sed, the -i option expects an extension argument so your command is actually parsed as the extension argument and the file path is interpreted as the command code.

See this thread for details.

yimingli avatar Jan 08 '22 21:01 yimingli

Ran into a couple of additional issues running make html, see the Makefile here. I use a MacBook Air (M1, 2020), using macOS Big Sur 11.6.2.

issue 1

rename 's/graph_objs/graph_objects/' _build/html/*.html _build/html/generated/*.html
  1. mac OS doesn't have rename utility. I installed using homebrew. brew install rename and tried again.
  2. But this time it returns error saying "_build/html/generated/plotly.graph_objects.html already exists".

issue 2

sed -i '' -e 's/graph_objs/graph_objects/g' _build/html/*.inv

raises error: re error: illegal byte sequence. Following this guide, I fixed it by

LC_ALL=C sed -i '' -e 's/graph_objs/graph_objects/g' _build/html/*.inv

yimingli avatar Jan 09 '22 00:01 yimingli

👍

duckbill avatar Sep 07 '22 13:09 duckbill