Where to get RAND_egd?

2019-05-23 08:32发布

I am testing out an app in GAE. It runs fine when deployed to Google's server, but locally it crashes because it cannot import name RAND_egd. The place where it happens is in C:\Program Files(x86)Google\google_appengine\google\appengine\dist27\socket.py line 73:

from _ssl import RAND_add, RAND_egd, RAND_status, SSL_ERROR_ZERO_RETURN, SSL_ERROR_WANT_READ, SSL_ERROR_WANT_WRITE, SSL_ERROR_WANT_X509_LOOKUP, SSL_ERROR_SYSCALL, SSL_ERROR_SSL, SSL_ERROR_WANT_CONNECT, SSL_ERROR_EOF, SSL_ERROR_INVALID_ERROR_CODE

According to this SO answer, the solution is to comment out the import, but that was in the standard socket.py. I removed RAND_egd from the Google supplied file, and it worked, for now.

What is the proper solution to this problem? Will RAND_egd always be not needed in socket.py? Is that Google supplied socket.py not the same as the one in Google's web servers?

1条回答
\"骚年 ilove
2楼-- · 2019-05-23 08:37

There is nothing wrong with your solution. This is due to a bug in socket.py distributed with the SDK 1.9.38.

Windows doesn't support the RAND_egd library.

There is a more elegant workaround that conditionally imports the library if not Windows.

You have to make changes to the file: C:\Program Files (x86)\Google\google_appengine\google\appengine\dist27\socket.py

Then you can use Python later than 2.7.9 with the Windows App Engine SDK,

The required changes to the file are described here https://code.google.com/p/googleappengine/issues/detail?id=12783

You will need admin access to modify the file. It might be easier to edit the file in a writable location then copy it to the read-only destination.

Check the status of this issue. Hopefully, a new release of the SDK will mean the patch is no longer required. Otherwise, repeat this procedure after each upgrade of the App Engine SDK.

查看更多
登录 后发表回答