How can I solve 'Unable to find consistent por

2019-06-22 15:57发布

I'm attempting to run Google App Engine just to get a hello world app up but have been failing. I'm on Windows 7 and have tried to use the GUI launcher as well as the Cygwin terminal. Having followed many different suggestions from SO forums (Failed to start devlopment server -- BindError: Unable to find a consistent port localhost) and others:

-I have edited the localhosts entry in the etc/hosts file to 127.0.0.1

-I've reinstalled the Google App Engine package

-Tried editing the .yaml and main.py files

-Tried changing the port to 9000 and 8888

-Tried explicitly specifying the host I'm launching on? (eg: --skip_sdk_update_check=yes --port=8080 --admin_port=8000 --host 127.0.0.1)

-Tried specifically allowing the app engine launcher to communicate through the firewall

Nothing has made a difference yet.

The error message reads:

"2013-07-13 16:35:05 Running command: "['C:\\Python27\\python.exe', 'C:\\Program Files (x86)\\Google\\google_appengine\\dev_appserver.py', '--skip_sdk_update_check=yes', '--port=8080', '--admin_port=8000', u'C:\\Users\\Greg\\hello-udacity']"
INFO     2013-07-13 16:35:12,631 devappserver2.py:528] Skipping SDK update check.
WARNING  2013-07-13 16:35:12,655 api_server.py:314] Could not initialize images API; you are likely missing the Python "PIL" module.
WARNING  2013-07-13 16:35:12,660 simple_search_stub.py:955] Could not read search indexes from c:\users\greg\appdata\local\temp\appengine.hello-udacity\search_indexes
Traceback (most recent call last):
  File "C:\Program Files (x86)\Google\google_appengine\dev_appserver.py", line 182, in <module>
    _run_file(__file__, globals())
  File "C:\Program Files (x86)\Google\google_appengine\dev_appserver.py", line 178, in _run_file
    execfile(script_path, globals_)
  File "C:\Program Files (x86)\Google\google_appengine\google\appengine\tools\devappserver2\devappserver2.py", line 695, in <module>
    main()
  File "C:\Program Files (x86)\Google\google_appengine\google\appengine\tools\devappserver2\devappserver2.py", line 688, in main
    dev_server.start(options)
  File "C:\Program Files (x86)\Google\google_appengine\google\appengine\tools\devappserver2\devappserver2.py", line 659, in start
    apis.start()
  File "C:\Program Files (x86)\Google\google_appengine\google\appengine\tools\devappserver2\api_server.py", line 137, in start
    super(APIServer, self).start()
  File "C:\Program Files (x86)\Google\google_appengine\google\appengine\tools\devappserver2\wsgi_server.py", line 298, in start
    raise BindError('Unable to find a consistent port %s' % host)
google.appengine.tools.devappserver2.wsgi_server.BindError: Unable to find a consistent port localhost
2013-07-13 16:35:12 (Process exited with code 1)"

3条回答
狗以群分
2楼-- · 2019-06-22 16:08

It's probably too late, but I just ran into this same condition after updating AppEngine SDK. In the "wsgi_server.py" file edit the following line

class WsgiServer(object):
    .....
    def start(self):
        try:
           addrinfo = socket.getaddrinfo(host, port, socket.AF_UNSPEC,
                                socket.SOCK_STREAM, 0, socket.AI_PASSIVE)

to

class WsgiServer(object):
    .....
    def start(self):
        try:
           addrinfo = socket.getaddrinfo(host, port, socket.AF_UNSPEC,
                                socket.SOCK_STREAM, 1, socket.AI_PASSIVE)
查看更多
SAY GOODBYE
3楼-- · 2019-06-22 16:09

From the error message it appears you are explicitly passing --skip_sdk_update_check=yes --port=8080 --admin_port=8000

Have you tried specifying the host you are launching on? eg:

--skip_sdk_update_check=yes --port=8080 --admin_port=8000 --host 127.0.0.1

Another item of interest would be to temporarily kill any firewalls you have running on your machine and see if that makes a difference.

查看更多
家丑人穷心不美
4楼-- · 2019-06-22 16:19

Ran into this problem with a colleague in China with Astrall VPN running on the machine. Changed from Open mode to Stealth Mode, and this fixed the problem.

查看更多
登录 后发表回答