tensorflow / tensorboard

TensorFlow's Visualization Toolkit
Apache License 2.0
6.67k stars 1.65k forks source link

__getattr__ protocol not adhered to at module level #2612

Open ericspod opened 5 years ago

ericspod commented 5 years ago

Environment information (required)

Diagnostics output `````` --- check: autoidentify INFO: diagnose_tensorboard.py version 393931f9685bd7e0f3898d7dcdf28819fef54c43 --- check: general INFO: sys.version_info: sys.version_info(major=3, minor=7, micro=3, releaselevel='final', serial=0) INFO: os.name: posix INFO: os.uname(): posix.uname_result(sysname='Linux', nodename='bioeng187-pc', release='4.4.0-143-generic', version='#169-Ubuntu SMP Thu Feb 7 07:56:38 UTC 2019', machine='x86_64') INFO: sys.getwindowsversion(): N/A --- check: package_management INFO: has conda-meta: True INFO: $VIRTUAL_ENV: None --- check: installed_packages INFO: installed: tb-nightly==1.14.0a20190603 INFO: installed: tensorflow-gpu==2.0.0b0 INFO: installed: tf-estimator-nightly==1.14.0.dev2019060501 --- check: tensorboard_python_version INFO: tensorboard.version.VERSION: '1.14.0a20190603' --- check: tensorflow_python_version INFO: tensorflow.__version__: '2.0.0-beta0' INFO: tensorflow.__git_version__: 'v1.12.1-3259-gf59745a' --- check: tensorboard_binary_path INFO: which tensorboard: b'/home/localek10/miniconda3/bin/tensorboard\n' --- check: readable_fqdn INFO: socket.getfqdn(): 'bioeng187-pc.isd.kcl.ac.uk' --- check: stat_tensorboardinfo INFO: directory: /tmp/.tensorboard-info INFO: .tensorboard-info directory does not exist --- check: source_trees_without_genfiles INFO: tensorboard_roots (1): ['/home/localek10/miniconda3/lib/python3.7/site-packages']; bad_roots (0): [] --- check: full_pip_freeze INFO: pip freeze --all: absl-py==0.7.1 alabaster==0.7.12 asn1crypto==0.24.0 astor==0.8.0 astroid==2.2.5 attrs==19.1.0 Babel==2.7.0 backcall==0.1.0 bleach==3.1.0 blessings==1.7 blinker==1.4 certifi==2019.6.16 cffi==1.12.3 chardet==3.0.4 cloudpickle==1.2.1 conda==4.7.11 conda-package-handling==1.3.11 coverage==4.5.3 cryptography==2.7 cycler==0.10.0 decorator==4.4.0 defusedxml==0.6.0 docutils==0.15.2 entrypoints==0.3 gast==0.2.2 google-pasta==0.1.7 gpustat==0.6.0 grpcio==1.23.0 h5py==2.9.0 idna==2.8 imageio==2.5.0 imagesize==1.1.0 ipykernel==4.10.0 ipython==7.7.0 ipython-genutils==0.2.0 ipywidgets==7.5.1 isort==4.3.21 jedi==0.15.1 jeepney==0.4 Jinja2==2.10.1 jsonschema==3.0.2 jupyter==1.0.0 jupyter-client==5.3.1 jupyter-console==6.0.0 jupyter-core==4.5.0 Keras-Applications==1.0.8 Keras-Preprocessing==1.1.0 keyring==18.0.0 kiwisolver==1.1.0 lazy-object-proxy==1.4.1 libarchive-c==2.8 Markdown==3.1.1 MarkupSafe==1.1.1 matplotlib==3.1.0 mccabe==0.6.1 mistune==0.8.4 mkl-fft==1.0.14 mkl-random==1.0.2 mkl-service==2.0.2 nbconvert==5.5.0 nbformat==4.4.0 nibabel==2.5.0 notebook==6.0.0 numpy==1.16.4 numpydoc==0.9.1 nvidia-ml-py3==7.352.0 olefile==0.46 packaging==19.1 pandas==0.25.1 pandocfilters==1.4.2 parso==0.5.1 pexpect==4.7.0 pickleshare==0.7.5 Pillow==6.1.0 pip==19.1.1 prometheus-client==0.7.1 prompt-toolkit==2.0.9 protobuf==3.9.1 psutil==5.6.3 ptyprocess==0.6.0 pycodestyle==2.5.0 pycosat==0.6.3 pycparser==2.19 pyflakes==2.1.1 Pygments==2.4.2 pylint==2.3.1 pyOpenSSL==19.0.0 pyparsing==2.4.2 pyrsistent==0.14.11 PySocks==1.7.0 python-dateutil==2.8.0 pytz==2019.2 PyYAML==5.1.2 pyzmq==18.1.0 QtAwesome==0.5.7 qtconsole==4.5.4 QtPy==1.9.0 requests==2.22.0 rope==0.14.0 ruamel-yaml==0.15.46 scipy==1.3.1 SecretStorage==3.1.1 Send2Trash==1.5.0 setuptools==41.0.1 six==1.12.0 snowballstemmer==1.9.0 Sphinx==2.1.2 sphinxcontrib-applehelp==1.0.1 sphinxcontrib-devhelp==1.0.1 sphinxcontrib-htmlhelp==1.0.2 sphinxcontrib-jsmath==1.0.1 sphinxcontrib-qthelp==1.0.2 sphinxcontrib-serializinghtml==1.1.3 spyder==3.3.6 spyder-kernels==0.5.1 tb-nightly==1.14.0a20190603 tensorflow-gpu==2.0.0b0 termcolor==1.1.0 terminado==0.8.2 testpath==0.4.2 tf-estimator-nightly==1.14.0.dev2019060501 torch==1.2.0 tornado==6.0.3 tqdm==4.32.1 traitlets==4.3.2 urllib3==1.24.2 virtualenv==16.0.0 wcwidth==0.1.7 webencodings==0.5.1 Werkzeug==0.15.5 wheel==0.33.4 widgetsnbextension==3.5.1 wrapt==1.11.2 wurlitzer==1.0.3 ``````

Issue description

The use of __getattr__ at the module level is not compliant with the specification in places. One place is https://github.com/tensorflow/tensorboard/blob/a22566561d2b4fea408755a951ac9eaf3a156f8e/tensorboard/compat/tensorflow_stub/pywrap_tensorflow.py#L35

This returns 0 always which is not correct, it should return a found member or raise AttributeError. Returning 0 does not play well with other code doing module searching for example.

nfelt commented 4 years ago

Thanks for the report. This is copied code to provide a compatibility layer so I think it probably took some shortcuts; we'd be happy to accept a fix.