Skip to content

ModuleWatcher: ability to append to whitelist #23

Open
@philipstarkey

Description

@philipstarkey

Original report (archived issue) by Russell Anderson (Bitbucket: rpanderson, GitHub: rpanderson).


Use case: reloading tensorflow fails.

Minimum failing example: lyse analysis routine containing:

import your_face
import tensorflow.core

… where your_face.py contains:

print('Your face')

Modify your_face.py to trigger module reloading, and get:

Traceback (most recent call last):
  File "C:\labscript_suite\userlib\analysislib\common\tensorflow_bug.py", line 2, in <module>
    import tensorflow.core
  File "C:\ProgramData\Anaconda3\lib\site-packages\tensorflow\__init__.py", line 24, in <module>
    from tensorflow.python import pywrap_tensorflow  # pylint: disable=unused-import
  File "C:\ProgramData\Anaconda3\lib\site-packages\tensorflow\python\__init__.py", line 52, in <module>
    from tensorflow.core.framework.graph_pb2 import *
  File "C:\ProgramData\Anaconda3\lib\site-packages\tensorflow\core\framework\graph_pb2.py", line 15, in <module>
    from tensorflow.core.framework import node_def_pb2 as tensorflow_dot_core_dot_framework_dot_node__def__pb2
  File "C:\ProgramData\Anaconda3\lib\site-packages\tensorflow\core\framework\node_def_pb2.py", line 15, in <module>
    from tensorflow.core.framework import attr_value_pb2 as tensorflow_dot_core_dot_framework_dot_attr__value__pb2
  File "C:\ProgramData\Anaconda3\lib\site-packages\tensorflow\core\framework\attr_value_pb2.py", line 15, in <module>
    from tensorflow.core.framework import tensor_pb2 as tensorflow_dot_core_dot_framework_dot_tensor__pb2
  File "C:\ProgramData\Anaconda3\lib\site-packages\tensorflow\core\framework\tensor_pb2.py", line 15, in <module>
    from tensorflow.core.framework import resource_handle_pb2 as tensorflow_dot_core_dot_framework_dot_resource__handle__pb2
  File "C:\ProgramData\Anaconda3\lib\site-packages\tensorflow\core\framework\resource_handle_pb2.py", line 91, in <module>
    __module__ = 'tensorflow.core.framework.resource_handle_pb2'
TypeError: A Message class can only inherit from Message

Similar issue reported here, where Spyder users report disabling the user-module reloader, or preventing google.* modules from being reloaded. For me, the above error was resolved by modifying modulewatcher.py to prevent tensorflow.* modules from being reloaded.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions