Issue with python 3.11.1 on visual studio code

We uses Python in our application. The current version of python we are using is 3.10.6 and I want to upgrade to the newer version 3.11.x. But there is an issue I am facing with 3.11.x version. We launch Visual studio code from our application by running python scripts. But with version 3.11.x the visual studio was not getting launch. The below is the traceback of the error.

Traceback (most recent call last):
  File "<string>", line 2, in <module>
  File "C:\Users\singng\.vscode\extensions\ms-python.python-2023.6.1\pythonFiles\lib\python\debugpy\", line 31, in wrapper
    return wrapped(*args, **kwargs)
  File "C:\Users\singng\.vscode\extensions\ms-python.python-2023.6.1\pythonFiles\lib\python\debugpy\server\", line 143, in debug
    log.reraise_exception("{0}() failed:", func.__name__, level="info")
  File "C:\Users\singng\.vscode\extensions\ms-python.python-2023.6.1\pythonFiles\lib\python\debugpy\server\", line 141, in debug
    return func(address, settrace_kwargs, **kwargs)
  File "C:\Users\singng\.vscode\extensions\ms-python.python-2023.6.1\pythonFiles\lib\python\debugpy\server\", line 282, in listen
  File "C:\Users\singng\.vscode\extensions\ms-python.python-2023.6.1\pythonFiles\lib\python\debugpy\server\", line 45, in _settrace
    return pydevd.settrace(*args, **kwargs)
  File "C:\Users\singng\.vscode\extensions\ms-python.python-2023.6.1\pythonFiles\lib\python\debugpy\_vendored\pydevd\", line 2821, in settrace
 File "C:\Users\singng\.vscode\extensions\ms-python.python-2023.6.1\pythonFiles\lib\python\debugpy\_vendored\pydevd\", line 2881, in _locked_settrace
    py_db = PyDB()
  File "C:\Users\singng\.vscode\extensions\ms-python.python-2023.6.1\pythonFiles\lib\python\debugpy\_vendored\pydevd\", line 535, in __init__
    self._files_filtering = FilesFiltering()
  File "C:\Users\singng\.vscode\extensions\ms-python.python-2023.6.1\pythonFiles\lib\python\debugpy\_vendored\pydevd\_pydevd_bundle\", line 117, in __init__
    library_roots = self._get_default_library_roots()
  File "C:\Users\singng\.vscode\extensions\ms-python.python-2023.6.1\pythonFiles\lib\python\debugpy\_vendored\pydevd\_pydevd_bundle\", line 159, in _get_default_library_roots
AttributeError: module 'os' has no attribute '__file__'

As per trace back there is no __file__ attribute in os module. Does python 3.11.1 removed __file__ atrribute from os module? How can I fix this issue? since the error i am getting on on vscode extensions file i cannot make any changes on it.

I’ve just checked and the os module in Python 3.11.1 still has the __file__ attribute. Is there another file that’s shadowing the stdlib’s os?

I am not sure if any other file is shadowing. How can i check for the file which is shadowing the stdlib’s os?

Do you have a file named

The file which I get the error is part of the vscode extensions. And I don’t see any file with the name apart from which is present in the python folder. This error does not present with python version 3.9.x and 3.10.x. Error is with python 3.11.x. (3.11.0, 3.11.1, 3.11.2, 3.11.3).