# Load the debugger package try: ptvs_lib_path = os.path.join(os.path.dirname(__file__), 'ptvsd') sys.path.append(ptvs_lib_path) try: import ptvsd import ptvsd.debugger as vspd from ptvsd.__main__ import main ptvsd_loaded = True except ImportError: ptvsd_loaded = False raise vspd.DONT_DEBUG.append(os.path.normcase(__file__)) except: traceback.print_exc() print(''' Internal error detected. Please copy the above traceback and report at https://github.com/Microsoft/vscode-python/issues/new Press Enter to close. . .''') try: raw_input() except NameError: input() sys.exit(1) finally: if ptvs_lib_path: sys.path.remove(ptvs_lib_path) main(sys.argv)
if useCustomPtvsd: sys.path.append(ptvs_lib_path) else: sys.path.insert(0, ptvs_lib_path) try: import ptvsd import ptvsd.debugger as vspd from ptvsd.__main__ import main ptvsd_loaded = True except ImportError: ptvsd_loaded = False raise vspd.DONT_DEBUG.append(os.path.normcase(__file__)) except: traceback.print_exc() print(''' Internal error detected. Please copy the above traceback and report at https://github.com/Microsoft/vscode-python/issues/new Press Enter to close. . .''') try: raw_input() except NameError: input() sys.exit(1) finally: if ptvs_lib_path: sys.path.remove(ptvs_lib_path) main(ptvsdArgs)
# Simple ptvsd loader # Example usage <flask>: # cd /app # env PYTHONIOENCODING=UTF-8 PYTHONUNBUFFERED=1 # python loader.py --default --client --host localhost --port 3000 -m flask run --no-debugger --no-reload --port=5000 --host=0.0.0.0 import os import os.path import sys import traceback args = sys.argv[:] try: lib_path = os.path.join(os.path.dirname(__file__), 'lib', 'python') sys.path.insert(0, lib_path) try: import ptvsd from ptvsd.__main__ import main except ImportError: raise except: traceback.print_exc() sys.exit(1) finally: sys.path.remove(lib_path) #print(args) main(args)