How to setup vscode Python debugger for an app eng

2019-03-27 17:10发布

After following the steps in the official wiki I keep getting the following error when launching with breakpoints or setting breakpoints:

    /ptvsd/wrapper.py", line 423, in pydevd_request
    os.write(self.pipe_w, s.encode('utf8'))
  File "google-cloud-sdk/platform/google_appengine/google/appengine/tools/devappserver2/python/runtime/stubs.py", line 40, in os_error_not_implemented
    raise OSError(errno.ENOSYS, 'Function not implemented')
OSError: [Errno 38] Function not implemented

The application runs anyway but the breakpoints are never hit. It seems that ptvsd is trying to use some method that is blocked by the app engine sandboxed environment. I'm running vscode in a python virtualenv, any clue?

2条回答
SAY GOODBYE
2楼-- · 2019-03-27 17:45

My solution was to use PyCharm community edition's debugger, its similar perhaps more capable IDE and debugger for Python specific debugging.

查看更多
放我归山
3楼-- · 2019-03-27 17:59

I have tried to find a reliable way to get rid of this error but it's proving quite difficult. Here are some advices though:

  • Use the --threadsafe_override=default:false flag when running the app engine dev server as explained here.

  • The app engine dev server must be launched from vscode(for example via a task) instead of a separate terminal window.

  • If you still get the error, stop the debugger, kill the task and restart everything.

(After that the debugger correctly hits the breakpoints, but curiously the callstack is set to the main thread instead of the thread containing the breakpoint, you need to manually click on the correct thread in the callstack window.)

查看更多
登录 后发表回答