2011-08-15 29 views
5

我正在做一些應該很簡單並且一遍又一遍地卡住的事情。上傳很簡單的CSV文件到我的開發服務器,當我得到這個錯誤:使用開發服務器的Appengine BulkLoader問題

Error in WorkerThread-0: app "dev~fbdec" cannot access app "fbdec"'s data 

確切的輸出端:

[INFO ] Logging to bulkloader-log-20110815.142554 
[INFO ] Throttling transfers: 
[INFO ] Bandwidth: 250000 bytes/second 
[INFO ] HTTP connections: 8/second 
[INFO ] Entities inserted/fetched/modified: 20/second 
[INFO ] Batch Size: 10 
[INFO ] Opening database: bulkloader-progress-20110815.142554.sql3 
Please enter login credentials for localhost 
Email: [email protected] 
Password for [email protected]: 
[INFO ] Connecting to localhost:8080/remote_api 
[INFO ] Skipping header line. 
[INFO ] Starting import; maximum 10 entities per post 
[ERROR ] [WorkerThread-0] WorkerThread: 
Traceback (most recent call last): 
File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/tools/adaptive_thread_pool.py", line 176, in WorkOnItems 
status, instruction = item.PerformWork(self.__thread_pool) 
File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/tools/bulkloader.py", line 764, in PerformWork 
transfer_time = self._TransferItem(thread_pool) 
File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/tools/bulkloader.py", line 935, in _TransferItem 
self.request_manager.PostEntities(self.content) 
File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/tools/bulkloader.py", line 1418, in PostEntities 
datastore.Put(entities) 
File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/api/datastore.py", line 467, in Put 
return PutAsync(entities, **kwargs).get_result() 
File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/datastore/datastore_rpc.py", line 658, in get_result 
results = self.__rpcs[0].get_result() 
File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/api/apiproxy_stub_map.py", line 592, in get_result 
return self.__get_result_hook(self) 
File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/datastore/datastore_rpc.py", line 1385, in __put_hook 
self.check_rpc_success(rpc) 
File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/datastore/datastore_rpc.py", line 1074, in check_rpc_success 
raise _ToDatastoreError(err) 
BadRequestError: app "dev~fbdec" cannot access app "fbdec"'s data 
[INFO ] An error occurred. Shutting down... 
[ERROR ] Error in WorkerThread-0: app "dev~fbdec" cannot access app "fbdec"'s data 
[INFO ] 2 entities total, 0 previously transferred 
[INFO ] 0 entities (723 bytes) transferred in 7.9 seconds 
[INFO ] Some entities not successfully transferred 

這是app.yaml文件:

application: fbdec 
version: 1 
runtime: python 
api_version: 1 

handlers: 
- url: /static 
    static_dir: static 

- url: /remote_api 
    script: $PYTHON_LIB/google/appengine/ext/remote_api/handler.py 
    login: admin 

- url: /.* 
    script: fbdec.py 

這個外殼調用來執行上傳:

appcfg.py upload_data --config_file=fbdec/fbuploader.py --filename=cols.csv --kind=Cols --has_header --num_threads=1 --url=http://localhost:8080/remote_api fbdec/ 

這是上傳代碼:

import cgi 
import datetime 
import logging 
import os 

import datetime 
from google.appengine.ext import db 
from google.appengine.tools import bulkloader 
from os import environ 


class Grobs(db.Model): 
    coleccion = db.TextProperty() 
    objeto= db.TextProperty() 
    descripcion = db.TextProperty() 

class GrobLoader(bulkloader.Loader): 
    def __init__(self): 
     bulkloader.Loader.__init__(self, 'Grobs', 
            [('coleccion', str), 
            ('objeto', str), 
            ('descripcion', str) 
            ]) 

class Cols(db.Model): 
    coleccion = db.TextProperty() 
    descripcion= db.TextProperty() 

class ColLoader(bulkloader.Loader): 
    def __init__(self): 
     bulkloader.Loader.__init__(self, 'Cols', 
            [('coleccion', str), 
            ('descripcion', str) 
            ]) 

loaders = [GrobLoader, ColLoader] 

而且這個cols.csv文件:

coleccion,descripcion 
gafas,descripcion 
sombreros,descripcion 

任何幫助將是非常歡迎的。我無法弄清楚我做錯了什麼。

我在Mac Osx Leopard上使用Appengine 1.5.2。我已經嘗試了python 2.5.4和2.6.6(以防萬一)。

在此先感謝和問候!

+2

的問題是,幫助揭露問題的應用程序必須與「S〜」的高冗餘應用程序名稱的前綴,開發服務器應用程序中添加了「dev〜」前綴。理論上,當一切正常時,這些前綴應該是透明的。您可能需要在命令行上提供'--application =',不過我不確定是否要在其中包含開發者。 – geoffspear

+0

感謝您的解釋。不知道。我已經嘗試過Robert Kluin的參數並且工作得很好。最好。 –

+0

升級到最新的SDK應該解決這個問題。 –

回答

7

啓動dev_appserver時,傳遞參數--default_partition=""

+0

非常感謝。這解決了問題。感謝您的驚人快速反應。祝一切順利。 Javier; –

+2

Javier;用tick來接受答案,這個問題關閉了這個問題,並讓Robert更加快樂。 –

+0

Didnt知道,要麼....(誰說新手?)。謝謝。 –

4

在較新的SDK上,使用--application = dev〜your-app選項。

0

最近我有同樣的問題,所以我創建了一個腳本來做到這一點:

APP=$1 #your app name 
IN=$2 #the file containing the data to upload 
DIR=$3 #the folder containing your app.yaml 
appcfg.py upload_data [email protected] --passin --application=dev~$APP --filename=$IN --url=http://localhost:8080/_ah/remote_api $DIR -v 
相關問題