Python 使用开发服务器时出现的Appengine散货装载机问题

Python 使用开发服务器时出现的Appengine散货装载机问题,python,google-app-engine,bulkloader,Python,Google App Engine,Bulkloader,我正在做一些应该简单的事情,并且一次又一次地陷入困境。将非常简单的csv文件上载到我的开发服务器时出现此错误: 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: 250

我正在做一些应该简单的事情,并且一次又一次地陷入困境。将非常简单的csv文件上载到我的开发服务器时出现此错误:

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: a@a.com
Password for a@a.com: 
[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
此命令用于执行上载的shell调用:

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(以防万一)


提前感谢并致以最良好的问候

启动dev\u appserver时,传递
--default\u partition=“”
参数。

在较新的SDK上,使用--application=dev~您的应用程序选项。

我最近遇到了同样的问题,因此我创建了一个脚本来执行此操作:

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=foobar@nowhere.com --passin --application=dev~$APP --filename=$IN --url=http://localhost:8080/_ah/remote_api $DIR -v

问题在于,为了帮助暴露应用程序在高冗余应用程序名称上使用“s~”前缀可能存在的问题,在开发服务器应用程序中添加了一个“dev~”前缀。理论上,当一切正常时,这些前缀应该是透明的。您可能需要在命令行中提供
--application=
,尽管我不确定是否要在其中包含dev~。谢谢您的解释。我不知道。我试过Robert Kluin的参数,效果也不错。最好的。升级到最新的SDK应该可以解决这个问题。它是最新的。事实上,情况正好相反。我已经返回到一个旧版本(我在某处有一个1.3.5安装程序)进行测试,在那里问题不会出现,并且它在没有添加--default_分区选项的情况下工作。非常感谢。这就解决了问题。感谢您的快速回复。祝你一切顺利;用勾号接受答案,这就结束了问题,让Robert的内心更加快乐。要在GoogleAppEngineLauncher上实现这一点,右键单击应用程序,然后从菜单中选择“信息…”,然后键入“额外标志”-default_partition=并更新。请特别注意,不应添加结尾处的引号。我在Python2.7.3中遇到了类似的问题。除了特殊的例外情况,
没有名为my_model的模块
。这里的详细信息:显然,sdkv1.8.6中的
appcfg.py
不识别此标志。还有其他想法吗?