*TL;DR:*  the dev_appserver.py tool's list of supported runtimes needs to 
be updated to include the python38 runtime

*My hacky workaround/solution:*
I found and edited the runtime_factories.py file located in the gcloud 
devappserver2 tool directory. On my Ubuntu 18.04 install, it was located 
here: 
```
/usr/lib/google-cloud-sdk/platform/google_appengine/google/appengine/tools/devappserver2/runtime_factories.py
```

I added `python38` to both `MODERN_RUNTIMES` and `FACTORIES` like this:
```
MODERN_RUNTIMES = set(['python38', 'python37', 'go111'])


FACTORIES = {
    'go': go_factory.GoRuntimeInstanceFactory,
    'go111': go_factory.GoRuntimeInstanceFactory,
    'php55': php_factory.PHPRuntimeInstanceFactory,
    'php72': php_factory.PHPRuntimeInstanceFactory,
    'python': python_factory.PythonRuntimeInstanceFactory,
    'python38': python_factory.PythonRuntimeInstanceFactory,
    'python37': python_factory.PythonRuntimeInstanceFactory,
    'python27': python_factory.PythonRuntimeInstanceFactory,
    'python-compat': python_factory.PythonRuntimeInstanceFactory,
    'custom': custom_factory.CustomRuntimeInstanceFactory,
}
```

Then hit save, and ran dev_appserver.py again and IT WORKED! I've also 
confirmed that it's actually running python38 runtime! 

@Google, please update the tool so others don't have to do this hacky 
workaround! 🙏

Thank you!

On Wednesday, January 13, 2021 at 11:32:16 AM UTC-5 Boro wrote:

> I'm trying to upgrade the GAE runtime on several python projects from 
> python37 to python38.
> I've used dev_appserver.py to test the apps locally before we deploy but 
> I'm getting an unknown runtime error after changing the runtime to 
> python38. Python 3.8 should be a supported runtime according to the appengine 
> docs 
> <https://cloud.google.com/appengine/docs/standard/python3/configuring-your-app-with-app-yaml>
> .
>
> I've also updated all gcloud cli components to the latest version. Is this 
> just something that's been changed/deprecated and I'm just not aware of it? 
> or is it actually a bug and missing from the `dev_appserver.py` tool?
>
> Any help would be appreciated! :)
>
>
> ```
> RuntimeError: Unknown runtime 'python38'; supported runtimes are 'custom', 
> 'go', 'go111', 'java', 'java7', 'java8', 'php55', 'php72', 'python', 
> 'python-compat', 
> 'python27', 'python37'.
> ```
>
>
> Full traceback:
>
> ```
> Traceback (most recent call last):
>   File "/mnt/c/Users/Admin/AppData/Local/Google/Cloud 
> SDK/google-cloud-sdk/platform/google_appengine/dev_appserver.py", line 96, 
> in <module>
>     _run_file(__file__, globals())
>   File "/mnt/c/Users/Admin/AppData/Local/Google/Cloud 
> SDK/google-cloud-sdk/platform/google_appengine/dev_appserver.py", line 90, 
> in _run_file
>     execfile(_PATHS.script_file(script_name), globals_)
>   File "/mnt/c/Users/Admin/AppData/Local/Google/Cloud 
> SDK/google-cloud-sdk/platform/google_appengine/google/appengine/tools/devappserver2/devappserver2.py",
>  
> line 613, in <module>
>     main()
>   File "/mnt/c/Users/Admin/AppData/Local/Google/Cloud 
> SDK/google-cloud-sdk/platform/google_appengine/google/appengine/tools/devappserver2/devappserver2.py",
>  
> line 601, in main
>     dev_server.start(options)
>   File "/mnt/c/Users/Admin/AppData/Local/Google/Cloud 
> SDK/google-cloud-sdk/platform/google_appengine/google/appengine/tools/devappserver2/devappserver2.py",
>  
> line 373, in start
>     options.api_host, apiserver.port, wsgi_request_info_)
>   File "/mnt/c/Users/Admin/AppData/Local/Google/Cloud 
> SDK/google-cloud-sdk/platform/google_appengine/google/appengine/tools/devappserver2/dispatcher.py",
>  
> line 259, in start
>     ssl_port)
>   File "/mnt/c/Users/Admin/AppData/Local/Google/Cloud 
> SDK/google-cloud-sdk/platform/google_appengine/google/appengine/tools/devappserver2/dispatcher.py",
>  
> line 396, in _create_module
>     ssl_port=ssl_port)
>   File "/mnt/c/Users/Admin/AppData/Local/Google/Cloud 
> SDK/google-cloud-sdk/platform/google_appengine/google/appengine/tools/devappserver2/module.py",
>  
> line 1313, 
> in __init__
>     super(AutoScalingModule, self).__init__(**kwargs)
>   File "/mnt/c/Users/Admin/AppData/Local/Google/Cloud 
> SDK/google-cloud-sdk/platform/google_appengine/google/appengine/tools/devappserver2/module.py",
>  
> line 599, in __init__
>     self._module_configuration)
>   File "/mnt/c/Users/Admin/AppData/Local/Google/Cloud 
> SDK/google-cloud-sdk/platform/google_appengine/google/appengine/tools/devappserver2/module.py",
>  
> line 226, in _create_instance_factory
>     sorted(repr(k) for k in runtime_factories.FACTORIES))))
> RuntimeError: Unknown runtime 'python38'; supported runtimes are 'custom', 
> 'go', 'go111', 'java', 'java7', 'java8', 'php55', 'php72', 'python', 
> 'python-compat', 
> 'python27', 'python37'.
> ```
>

-- 
You received this message because you are subscribed to the Google Groups 
"Google App Engine" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/google-appengine/0ff40104-d0a3-4677-9bb3-21bd3c62f917n%40googlegroups.com.

Reply via email to