tensorflow: Error after running `python generate2.py --output_dir=/tmp/out`
System information
- OS Platform and Distribution: Windows 10 1809 build: 17763.2300
- Mobile device if the issue happens on mobile device:
- TensorFlow installed from (source or binary):
- TensorFlow version: 2.6.0
- Python version: 3.9.7
- Installed using virtualenv? pip? conda?: pip
- Bazel version (if compiling from source):
- GCC/Compiler version (if compiling from source):
- CUDA/cuDNN version:
- GPU model and memory: Got no GPU
Describe the problem
Followed these instructions, but encountered the following error after running python generate2.py --output_dir=/tmp/out:

Provide the exact sequence of commands / steps that you executed before running into the problem
pip install git+https://github.com/tensorflow/docs
git clone https://github.com/tensorflow/tensorflow
cd tensorflow/tensorflow/tools/docs
python generate2.py --output_dir=/tmp/out
Any other info / logs Include any logs or source code that would be helpful to diagnose the problem. If including tracebacks, please include the full traceback. Large logs and files should be attached. tf.log
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Comments: 16 (10 by maintainers)
Hi,
Thanks for your patience on this one.
So the code where it’s failing now is here:
https://github.com/tensorflow/docs/blob/6914e839f3b89d4d25c56277108ab2b8d1c18619/tools/tensorflow_docs/api_generator/parser.py#L588
Basically it’s trying to determine which file a python object was defined in, and then convert that to a URL pointing to github.
The code path is:
base_dirs_and_prefixesis a list of(directory, url)pairs.obj_pathis the file we found this object was defined in.The code is trying to determine which “base directory” the source lives in, so it can apply the right URL prefix.
So I guess some of the code is installed on
C:and some is installed onD:. So it’s trying to document an object it found on C, and it’s trying to check if that source file is in a directory on D. I think there’s a simple fix here usingpathlib.Path.is_relative_to.I’m sending a quick fix.
tensorflow/docs@01d385dda9778a426f4d1cc84c60917a21856816 is in, just waiting for tensorflow/docs#1991 and this should be resolved.
Quick update - I have a PR in the works to sort this out, but I still need to do some more testing to make sure I’ve got everything. Should be ready for review tomorrow.