CUDA_LAUNCH_BLOCKING in Jupyter Notebook

I would like to debug the error

RuntimeError: CUDA error: invalid configuration argument
CUDA kernel errors might be asynchronously reported at some other API call,so the stacktrace below might be incorrect.

In this answer , it is suggested to use

os.environ['CUDA_LAUNCH_BLOCKING'] = 1

at the beginning of a jupyter notebook (I use VS Code) in order to debug but it throws the error

\my_notebook.ipynb Zelle 13 in <cell line: 1>()
----> 1 os.environ['CUDA_LAUNCH_BLOCKING'] = 1
      3 # %load_ext autoreload
      4 # %autoreload 2

File c:\ProgramData\Anaconda3\lib\, in _Environ.__setitem__(self, key, value)
    682 def __setitem__(self, key, value):
    683     key = self.encodekey(key)
--> 684     value = self.encodevalue(value)
    685     putenv(key, value)
    686     self._data[key] = value

File c:\ProgramData\Anaconda3\lib\, in _createenviron.<locals>.check_str(value)
    740 def check_str(value):
    741     if not isinstance(value, str):
--> 742         raise TypeError("str expected, not %s" % type(value).__name__)
    743     return value

TypeError: str expected, not int

As the error message points out, pass a string if you want to set it in Python:

os.environ['CUDA_LAUNCH_BLOCKING'] = "1"

and make sure it’s set before the CUDA context is initialized as it won’t have any effect otherwise.