You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tvm.apache.org by tq...@apache.org on 2021/02/25 14:54:01 UTC

[tvm] branch main updated: [PYTHON] Enable proper error message in python package (#7521)

This is an automated email from the ASF dual-hosted git repository.

tqchen pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/tvm.git


The following commit(s) were added to refs/heads/main by this push:
     new 772fa6b  [PYTHON] Enable proper error message in python package (#7521)
772fa6b is described below

commit 772fa6bda3a6244514d8a5d6637d43815d8f9a14
Author: Tianqi Chen <tq...@users.noreply.github.com>
AuthorDate: Thu Feb 25 09:53:41 2021 -0500

    [PYTHON] Enable proper error message in python package (#7521)
---
 python/tvm/__init__.py | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/python/tvm/__init__.py b/python/tvm/__init__.py
index c2b4fdb..7a5f553 100644
--- a/python/tvm/__init__.py
+++ b/python/tvm/__init__.py
@@ -68,6 +68,11 @@ from . import support
 from .contrib import rocm as _rocm, nvcc as _nvcc, sdaccel as _sdaccel
 
 
+# NOTE: This file should be python2 compatible so we can
+# raise proper error message when user run the package using
+# an older version of the python
+
+
 def _should_print_backtrace():
     in_pytest = "PYTEST_CURRENT_TEST" in os.environ
     tvm_backtrace = os.environ.get("TVM_BACKTRACE", "0")
@@ -76,7 +81,7 @@ def _should_print_backtrace():
         tvm_backtrace = bool(int(tvm_backtrace))
     except ValueError:
         raise ValueError(
-            f"invalid value for TVM_BACKTRACE `{tvm_backtrace}`, please set to 0 or 1."
+            "invalid value for TVM_BACKTRACE {}, please set to 0 or 1.".format(tvm_backtrace)
         )
 
     return in_pytest or tvm_backtrace