Unable to Debug Dev Appserver using pycharm, but able to run fine

367 Views Asked by At

Attempting to run a python 2.7 app engine app locally using PyCharm (which uses dev_appserver) my machine is python 3.7 but I have a python 2.7 virtual env setup as the project interpreter, which works fine when running the project.

However when attempting to debug the same run config (which runs fine) I am getting the following error

ERROR: (dev_appserver) python2: command not found

I can run the python2 command in my terminal both inside and outside the virtual environment so I am not sure what is wrong here.

I am currently running Pop!_OS 20.04 LTS if that helps.

2

There are 2 best solutions below

0
Gwyn Howell On BEST ANSWER

I have the same issue on mac catalina with Pycharm 2020.1.2. I was able to start the debugger by using a "Python configuration", rather than a "App Engine Server" configuration. Steps below:

  1. Click "Edit Configurations", and add a new "Python Configuration"
  2. In the Script Path, enter the full path to dev_appserver.py
  3. In Parameters, enter '--max_module_instances="default:1" .' (according to https://cloud.google.com/appengine/docs/standard/python/tools/using-local-server#debugging_with_pdb)
  4. In Working Directory, enter the path to your project

This isn't perfect, but at least you can run the debugger within pycharm.

I look forward to a better answer some day that works with the "App Engine Server" configuration.

0
crash843 On

I had the same issue after starting new AppEngine projects on python 3. Initially, I thought the problem was with a new version of Google Cloud SDK. I spent a lot of time linking/unlinking python versions and playing around the environment variables. But eventually, update of PyCharm to 2021.1.2 fixed the issue.