2017-08-13 34 views
1

我有打破的那一刻App Engine應用程序我谷歌應用程序引擎dev_appserver.py ioError在進口apache_beam

import apache_beam 

我可以證實的依賴關係的應用程序運行在虛擬環境中安裝的。通過評審它下面的堆棧跟蹤看起來像是試圖訪問/ dev/null出於某種原因,並且它失敗了。

INFO  2017-08-13 13:03:37,980 stubs.py:50] Sandbox prevented access to file "/home/raul/Downloads/google-cloud-sdk" 
INFO  2017-08-13 13:03:37,980 stubs.py:51] If it is a static file, check that `application_readable: true` is set in your app.yaml 
INFO  2017-08-13 13:03:37,980 stubs.py:50] Sandbox prevented access to file "/home/raul/Downloads/google-cloud-sdk/platform" 
INFO  2017-08-13 13:03:37,980 stubs.py:51] If it is a static file, check that `application_readable: true` is set in your app.yaml 
INFO  2017-08-13 13:03:38,260 stubs.py:50] Sandbox prevented access to file "/dev/null" 
INFO  2017-08-13 13:03:38,260 stubs.py:51] If it is a static file, check that `application_readable: true` is set in your app.yaml 
ERROR 2017-08-13 13:03:38,261 wsgi.py:263] 
Traceback (most recent call last): 
    File "/home/raul/Downloads/google-cloud-sdk/platform/google_appengine/google/appengine/runtime/wsgi.py", line 240, in Handle 
    handler = _config_handle.add_wsgi_middleware(self._LoadHandler()) 
    File "/home/raul/Downloads/google-cloud-sdk/platform/google_appengine/google/appengine/runtime/wsgi.py", line 299, in _LoadHandler 
    handler, path, err = LoadObject(self._handler) 
    File "/home/raul/Downloads/google-cloud-sdk/platform/google_appengine/google/appengine/runtime/wsgi.py", line 85, in LoadObject 
    obj = __import__(path[0]) 
    File "/home/raul/Documents/football/main.py", line 7, in <module> 
    import apache_beam 
    File "/home/raul/Documents/football/env/lib/python2.7/site-packages/apache_beam/__init__.py", line 75, in <module> 
    import apache_beam.internal.pickler 
    File "/home/raul/Documents/football/env/lib/python2.7/site-packages/apache_beam/internal/pickler.py", line 38, in <module> 
    import dill 
    File "/home/raul/Documents/football/env/lib/python2.7/site-packages/dill/__init__.py", line 27, in <module> 
    from .dill import dump, dumps, load, loads, dump_session, load_session, \ 
    File "/home/raul/Documents/football/env/lib/python2.7/site-packages/dill/dill.py", line 165, in <module> 
    FileType = type(open(os.devnull, 'rb', buffering=0)) 
    File "/home/raul/Downloads/google-cloud-sdk/platform/google_appengine/google/appengine/tools/devappserver2/python/stubs.py", line 260, in __init__ 
    raise IOError(errno.EACCES, 'file not accessible', filename) 
IOError: [Errno 13] file not accessible: '/dev/null' 

任何想法可能會導致這種情況,以及如何解決它?

+0

你是否在谷歌雲或本地環境中部署它?原因是,我也試圖添加一個cron來通過appengine運行數據流管道,它會幫助我。 :) – Anuj

+0

由於沙箱限制,我無法首先在開發服務器上運行它,所以我沒有部署它。靈活的環境似乎是這種用例的一種方式 –

回答

1

GAE Python sandbox在您的應用程序代碼允許執行的操作方面相當嚴格。它看起來像apache-beam使用的dill包需要訪問沙箱上不允許的特殊文件(在這種情況下爲/dev/null設備文件)。

您可以更改您的代碼以滿足所有沙盒要求,也可以嘗試使用the flexible environment,這更容忍一些(但它是一個不同的野獸)。見Choosing an App Engine EnvironmentMigrating Services from the Standard Environment to the Flexible Environment。注意:回溯表明你的應用程序試圖從本地系統安裝執行apache-beam,這也不能在標準環境中工作 - 它需要在你的應用程序中進行銷售,請參閱Installing a third-party library