必须有一个更简单的方法.
我今天尝试启动我的应用时收到此警告:
/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/tools/devappserver2/file_watcher.py:97:
UserWarning:不支持检测源代码更改,因为您的Python版本不包含PyObjC(http://pyobjc.sourceforge.net/).请安装PyObjC,如果不切实际,请在http://code.google.com/p/appengine-devappserver2-experiment/issues/list上提交错误.
在我的python代码中有一些地方,我有一个人口,x每个人都有可能发生一些事情,但我只需要受影响的人数.
amount = 0
population = 500
chance = 0.05
for p in range(population):
if random.random() < chance:
amount += 1
Run Code Online (Sandbox Code Playgroud)
我的直觉告诉我,除了调用random.random()500次之外,必须有一种不那么强力的方法.我不知道的一些数学或统计术语或功能.
amount = population * chance * random.random()
Run Code Online (Sandbox Code Playgroud)
根据我的需要变化太多了.
我有一些dificulty gettung 1.7.6跑步.收到以下错误:
INFO 2013-03-20 08:39:10,233 admin_server.py:117] Starting admin server at: http://localhost:8086
ERROR 2013-03-20 08:39:13,768 wsgi.py:219]
Traceback (most recent call last):
File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/runtime/wsgi.py", line 196, in Handle
handler = _config_handle.add_wsgi_middleware(self._LoadHandler())
File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/api/lib_config.py", line 353, in __getattr__
self._update_configs()
File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/api/lib_config.py", line 289, in _update_configs
self._registry.initialize()
File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/api/lib_config.py", line 164, in initialize
import_func(self._modname)
File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/tools/devappserver2/python/sandbox.py", line 890, in load_module
raise ImportError
ImportError
Run Code Online (Sandbox Code Playgroud)