#!/usr/bin/env python3
# Copyright (C) 2020 The Android Open Source Project
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#      http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

import os


# This function lives in its own module to allow us to use a different
# mechanism of loading depending on the build system.
def read_descriptor():
  ws = os.path.dirname(__file__)
  with open(os.path.join(ws, 'trace_processor.descriptor'), 'rb') as x:
    return x.read()

#!/usr/bin/env python3
# Copyright (C) 2020 The Android Open Source Project
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#      http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

import os


# This function lives in its own module to allow us to use a different
# mechanism of loading depending on the build system.
def read_descriptor():
  try:
    from .descriptor_vendor import read_tp_descriptor
    return read_tp_descriptor()
  except ModuleNotFoundError:
    ws = os.path.dirname(__file__)
    with open(os.path.join(ws, 'trace_processor.descriptor'), 'rb') as x:
      return x.read()

Add try block to read_descriptor for it to read the descriptor file correctly on Colab am: f81160f0c7 am: 8a3ff8c3f6 am: 34ff9bb285