Cannot running on App Engine application by Python37 beta.

已回答

Google App Engine can run python 37.
But Pycharm cannot running.

 

My python interpreter settings.

case python2.7

subprocess.CalledProcessError: Command '['python3', '--version']' returned non-zero exit status 127

 

case python3.7

AttributeError: module 'enum' has no attribute 'IntFlag'

 

 

Can running on my terminal. but it doesn't use Pycharm.

$ python --version
Python 3.7.0
$ $HOME/.pyenv/versions/2.7.12/bin/python /usr/local/lib/google-cloud-sdk/bin/dev_appserver.py .

 

How do I configure it to run and debug with Pycharm?

 

0

Hi,

>Google App Engine can run python 37

Does it work for you with Python 3.7 in the terminal?

>case python3.7

This is a known issue, please follow https://youtrack.jetbrains.com/issue/PY-31555

>case python2.7

It looks strange, there's a reference to python3 in the call for some reason. Could you please provide a full Run window output? Run Configuration and Settings | Project ... | Project Interpreter window screenshots are also welcomed.

0
Avatar
Permanently deleted user

Hi,

 

> Does it work for you with Python 3.7 in the terminal?
Yes.

However, dev_appserver.py needs to be run in python2.
And, target project needs to be run in python3.

$ python --version
Python 3.7.0
$ $HOME/.pyenv/versions/2.7.12/bin/python /usr/local/lib/google-cloud-sdk/bin/dev_appserver.py .

The local path is python3.
But, dev_appserver.py called by python2.
It can run.

> It looks strange, there's a reference to python3 in the call for some reason.

In the case python2.7, there doesn't has python3 path.
I think can't run pycharm by this setting. (dev_appserver.py is 2.7, and the project is 3.7)

Run Configuration and Settings | Project ... | Project Interpreter window screenshots are also welcomed.

case 3.7


/Users/hidaka-fumihiko/PycharmProjects/GaePy37Debug/venv/bin/python /usr/local/lib/google-cloud-sdk/bin/dev_appserver.py --host 127.0.0.1 .
Traceback (most recent call last):
File "/usr/local/lib/google-cloud-sdk/bin/dev_appserver.py", line 13, in <module>
from bootstrapping import bootstrapping
File "/usr/local/lib/google-cloud-sdk/bin/bootstrapping/bootstrapping.py", line 24, in <module>
from . import setup # pylint:disable=g-import-not-at-top
File "/usr/local/lib/google-cloud-sdk/bin/bootstrapping/setup.py", line 55, in <module>
from googlecloudsdk.core import properties
File "/usr/local/lib/google-cloud-sdk/lib/googlecloudsdk/core/properties.py", line 24, in <module>
import re
File "/Users/hidaka-fumihiko/.pyenv/versions/3.7.0/lib/python3.7/re.py", line 143, in <module>
class RegexFlag(enum.IntFlag):
AttributeError: module 'enum' has no attribute 'IntFlag'

Process finished with exit code 1

 

case 2.7

/Users/hidaka-fumihiko/.pyenv/versions/2.7.12/bin/python /usr/local/lib/google-cloud-sdk/bin/dev_appserver.py --host 127.0.0.1 .
WARNING 2018-09-10 21:25:07,830 devappserver2.py:124] *** Notice ***
In a few weeks dev_appserver will default to using the Cloud Datastore Emulator. We strongly recommend you to enable this change earlier.
To opt-in, run dev_appserver with the flag --support_datastore_emulator=True
Read the documentation: https://cloud.google.com/appengine/docs/standard/python/tools/migrate-cloud-datastore-emulator
Help us validate that the feature is ready by taking this survey: https://goo.gl/forms/UArIcs8K9CUSCm733
Report issues at: https://issuetracker.google.com/issues/new?component=187272

INFO 2018-09-10 21:25:07,837 devappserver2.py:178] Skipping SDK update check.
INFO 2018-09-10 21:25:08,869 api_server.py:275] Starting API server at: http://localhost:52530
INFO 2018-09-10 21:25:08,880 instance_factory.py:71] Detected Python 3.7.0

Traceback (most recent call last):
File "/Users/hidaka-fumihiko/.pyenv/versions/3.7.0/lib/python3.7/runpy.py", line 183, in _run_module_as_main
mod_name, mod_spec, code = _get_module_details(mod_name, _Error)
File "/Users/hidaka-fumihiko/.pyenv/versions/3.7.0/lib/python3.7/runpy.py", line 142, in _get_module_details
return _get_module_details(pkg_main_name, error)
File "/Users/hidaka-fumihiko/.pyenv/versions/3.7.0/lib/python3.7/runpy.py", line 109, in _get_module_details
__import__(pkg_name)
File "/Users/hidaka-fumihiko/.pyenv/versions/3.7.0/lib/python3.7/venv/__init__.py", line 7, in <module>
import logging
File "/Users/hidaka-fumihiko/.pyenv/versions/3.7.0/lib/python3.7/logging/__init__.py", line 26, in <module>
import sys, os, time, io, traceback, warnings, weakref, collections.abc
File "/Users/hidaka-fumihiko/.pyenv/versions/3.7.0/lib/python3.7/traceback.py", line 5, in <module>
import linecache
File "/Users/hidaka-fumihiko/.pyenv/versions/3.7.0/lib/python3.7/linecache.py", line 11, in <module>
import tokenize
File "/Users/hidaka-fumihiko/.pyenv/versions/3.7.0/lib/python3.7/tokenize.py", line 33, in <module>
import re
File "/Users/hidaka-fumihiko/.pyenv/versions/3.7.0/lib/python3.7/re.py", line 143, in <module>
class RegexFlag(enum.IntFlag):
AttributeError: module 'enum' has no attribute 'IntFlag'
INFO 2018-09-10 21:25:08,983 stub_util.py:357] Applying all pending transactions and saving the datastore
INFO 2018-09-10 21:25:08,984 stub_util.py:360] Saving search indexes
Traceback (most recent call last):
File "/usr/local/lib/google-cloud-sdk/platform/google_appengine/dev_appserver.py", line 96, in <module>
_run_file(__file__, globals())
File "/usr/local/lib/google-cloud-sdk/platform/google_appengine/dev_appserver.py", line 90, in _run_file
execfile(_PATHS.script_file(script_name), globals_)
File "/usr/local/lib/google-cloud-sdk/platform/google_appengine/google/appengine/tools/devappserver2/devappserver2.py", line 515, in <module>
main()
File "/usr/local/lib/google-cloud-sdk/platform/google_appengine/google/appengine/tools/devappserver2/devappserver2.py", line 503, in main
dev_server.start(options)
File "/usr/local/lib/google-cloud-sdk/platform/google_appengine/google/appengine/tools/devappserver2/devappserver2.py", line 263, in start
options.api_host, apiserver.port, wsgi_request_info_)
File "/usr/local/lib/google-cloud-sdk/platform/google_appengine/google/appengine/tools/devappserver2/dispatcher.py", line 262, in start
ssl_port)
File "/usr/local/lib/google-cloud-sdk/platform/google_appengine/google/appengine/tools/devappserver2/dispatcher.py", line 403, in _create_module
ssl_port=ssl_port)
File "/usr/local/lib/google-cloud-sdk/platform/google_appengine/google/appengine/tools/devappserver2/module.py", line 1333, in __init__
super(AutoScalingModule, self).__init__(**kwargs)
File "/usr/local/lib/google-cloud-sdk/platform/google_appengine/google/appengine/tools/devappserver2/module.py", line 617, in __init__
self._module_configuration)
File "/usr/local/lib/google-cloud-sdk/platform/google_appengine/google/appengine/tools/devappserver2/module.py", line 231, in _create_instance_factory
module_configuration=module_configuration)
File "/usr/local/lib/google-cloud-sdk/platform/google_appengine/google/appengine/tools/devappserver2/python/instance_factory.py", line 98, in __init__
self._SetupVirtualenvFromConfiguration()
File "/usr/local/lib/google-cloud-sdk/platform/google_appengine/google/appengine/tools/devappserver2/python/instance_factory.py", line 143, in _SetupVirtualenvFromConfiguration
self._venv_dir, requirements_file.name)
File "/usr/local/lib/google-cloud-sdk/platform/google_appengine/google/appengine/tools/devappserver2/python/instance_factory.py", line 225, in _SetupVirtualenv
call_res = subprocess.call(['virtualenv', venv_dir])
File "/Users/hidaka-fumihiko/.pyenv/versions/2.7.12/lib/python2.7/subprocess.py", line 523, in call
return Popen(*popenargs, **kwargs).wait()
File "/Users/hidaka-fumihiko/.pyenv/versions/2.7.12/lib/python2.7/subprocess.py", line 711, in __init__
errread, errwrite)
File "/Users/hidaka-fumihiko/.pyenv/versions/2.7.12/lib/python2.7/subprocess.py", line 1343, in _execute_child
raise child_exception
OSError: [Errno 2] No such file or directory

Process finished with exit code 1

 

Settings | Project ... | Project Interpreter

0

>The local path is python3. But, dev_appserver.py called by python2.

Maybe I am missing something, but you basically run it under Python 2, I don't think python3 as the first executable in PATH plays any role here.

>case 2.7

Could you please check if you have PYTHONPATH variable defined globally in your system?

echo $PYTHONPATH should do the trick. Does it work correctly if you set the project interpreter as Python 2 instead of changing it for a run configuration?

0
Avatar
Permanently deleted user

 > I don't think python3 as the first executable in PATH plays any role here.
Want to run python37 runtime. Not python27 runtime.
https://cloud.google.com/appengine/docs/standard/python3/runtime

I'm sorry when I different, I think needs to python37 because runtime is python37.


> Could you please check if you have PYTHONPATH variable defined globally in your system?
> echo $PYTHONPATH should do the trick. Does it work correctly if you set the project interpreter as Python 2 instead of changing it for a run configuration?
PYTHONPATH is not set.

Can run gae, If it is python27 runtime....
But this case is python37 runtime by gae.

Is there a way to run python 37 runtime with Pycharm?

0

>Is there a way to run python 37 runtime with Pycharm?

It's not yet supported, unfortunately.

1
Avatar
Permanently deleted user

">case python3.7

This is a known issue, please follow https://youtrack.jetbrains.com/issue/PY-31555"

AND 

">Is there a way to run python 37 runtime with Pycharm?

It's not yet supported, unfortunately."

Is there any update on WHEN this will be fixed. It is not really a satisfactory answer just to say this is not supported and to link to another issue which has no updates or progress shown.

Thanks

Paul

 

 

2
Avatar
Permanently deleted user

Same issue for me,  could someone reply to give a proper reply such as whether there is a plan to support it and when?

Thank you!

 

Yikang

0

Hi Yikang,

I do not have any ETA, unfortunately. But as soon as it gets In Progress status it can be expected to be released in one of the future updates. 

https://youtrack.jetbrains.com/issue/PY-31555

0

请先登录再写评论。