Skip to content

Fails to run in debug mode from within PyCharm #2

@Dev63

Description

@Dev63

From within PyCharm, I can run dev_appserver (with the patch applied), and everything appears to work.

  1. Create a Python (not App Engine) project
  2. In the Run config, set the script to C:/Users/XXX/AppData/Local/Google/Cloud SDK/google-cloud-sdk/bin/dev_appserver.py
  3. In the Run config, set the params to: --runtime_python_path C:\Python\Python39\python.exe --application my_project_name --python_virtualenv_path C:\Users\XXX\AppData\Local\Temp\appengine_devappserver_venv app.yaml
  4. In the Run config, set the environment var: CLOUDSDK_DEVAPPSERVER_PYTHON=C:\Python\Python27\python.exe

However, when I try to run in debug mode from PyCharm, I run into a problem in the modified instance_factory.py. Line 429 (call_res = subprocess.call(args)) returns a 1, indicating a problem. The fallback virtualenv code fails as well, and the exception that eventually gets thrown says "The system cannot find the file specified".

I'm not sure what the "specified file" is. Here are the arguments to that call:

args = ['C:\Python\Python39\python.exe', '-m', 'venv', 'C:\Users\XXX\AppData\Local\Temp\appengine_devappserver_venv\default']

I wasn't sure what the trailing 'default' meant, so I tried creating a 'default' subdirectory, but it didn't help, and strangely it got deleted during the fail. Just to cover all bases, I also tried not using the --python_virtualenv_path flag, but still ended up in a similar situation (different temporary folder name of course).

Note that to get PyCharm's editor to correctly handle code completion, I had to copy the google folder from the App Engine SDK installation (C:\Users\XXX\AppData\Local\Google\Cloud SDK\google-cloud-sdk\platform\google_appengine\google) into the project's venv\Lib\site-packages. I don't think this is related, though.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions