0

Doing my first PY from https://learn.microsoft.com/en-us/visualstudio/python/tutorial-working-with-python-in-visual-studio-step-04-debugging?view=vs-2019. First attempt to debug gives this prolog, and then runs the program correctly. Is this output normal? Or did the tutorial forget to have me set some setting somewhere? I am using VS-219 community for a long time, updated to recent versions and Installer added Pyton 2 hours ago.

  W+00000.203: /handling #1 request "launch" from Adapter/
   Failed to set up job object

   Traceback (most recent call last):
    File "c:\program files (x86)\microsoft visual studio\2019\community\common7\ide\extensions\microsoft\python\core\debugpy\launcher/../..\debugpy\launcher\debuggee.py", line 136, in spawn
      winapi.kernel32.AssignProcessToJobObject(job_handle, process_handle)
    File "c:\program files (x86)\microsoft visual studio\2019\community\common7\ide\extensions\microsoft\python\core\debugpy\launcher/../..\debugpy\launcher\winapi.py", line 68, in impl
      raise ctypes.WinError()
         PermissionError: [WinError 5] Access is denied.

   Stack where logged:
     File "C:\Program Files (x86)\Microsoft Visual Studio\Shared\Python37_64\lib\threading.py", line 890, in _bootstrap
       self._bootstrap_inner()
     File "C:\Program Files (x86)\Microsoft Visual Studio\Shared\Python37_64\lib\threading.py", line 926, in _bootstrap_inner
       self.run()
     File "C:\Program Files (x86)\Microsoft Visual Studio\Shared\Python37_64\lib\threading.py", line 870, in run
       self._target(*self._args, **self._kwargs)
     File "c:\program files (x86)\microsoft visual studio\2019\community\common7\ide\extensions\microsoft\python\core\debugpy\launcher/../..\debugpy\common\messaging.py", line 1504, in _run_handlers
       handler()
     File "c:\program files (x86)\microsoft visual studio\2019\community\common7\ide\extensions\microsoft\python\core\debugpy\launcher/../..\debugpy\common\messaging.py", line 747, in _handle
       result = handler(self)
     File "c:\program files (x86)\microsoft visual studio\2019\community\common7\ide\extensions\microsoft\python\core\debugpy\launcher/../..\debugpy\launcher\handlers.py", line 143, in launch_request
       debuggee.spawn(process_name, cmdline, env, redirect_output)
     File "c:\program files (x86)\microsoft visual studio\2019\community\common7\ide\extensions\microsoft\python\core\debugpy\launcher/../..\debugpy\launcher\debuggee.py", line 139, in spawn
       log.swallow_exception("Failed to set up job object", level="warning")
     File "c:\program files (x86)\microsoft visual studio\2019\community\common7\ide\extensions\microsoft\python\core\debugpy\launcher/../..\debugpy\common\log.py", line 218, in swallow_exception
       _exception(format_string, *args, **kwargs)
Martin
  • 1,430
  • 10
  • 19
  • 1
    You likely need to run in administrator mode. Take a look at some other posts about this error: https://stackoverflow.com/questions/26091530/permissionerror-winerror-5-access-is-denied-python-using-moviepy-to-write-gif – Timothy G. May 13 '21 at 17:58
  • That works. And not only. After running debug once with ADMIN rights, the next time I can run it in ordinary mode. Very strange behaviour, seems VS needs to organize something once for debugging sessions! – Martin May 14 '21 at 12:36
  • In the past, I use to configure my Visual Studio executable to always run in admin mode to avoid things like this. Glad it worked for you. Feel free to close as a dupe. – Timothy G. May 14 '21 at 13:58

0 Answers0