I enter data into the database using the following code:
import uuid
guid = str(uuid.uuid1()).replace('-','')
stocks = db.GqlQuery("select * from Portfolio where name = '" + nick +
"'")
for x in stocks:
t = ScripTracker(key_name=guid+str(x.scripcd))
t.api_key = guid
t.scripcd = str(x.scripcd)
t.status = 'working'
t.trials = 0
t.put()
I happened to note down manually one of the key_name values and then
tried to call that particular entity with db.get()
t = db.get('%s' % '4d875b61d92411deba7f85ac5b9931c5532628')
The above statement gives me an error saying:
-------
Traceback (most recent call last):
File "C:\Program Files\Google\google_appengine\google\appengine\ext
\webapp\__init__.py", line 507, in __call__
handler.get(*groups)
File "C:\My Websites\deostroll-stocktrack\main.py", line 213, in get
stock = db.get('%s' % '4d875b61d92411deba7f85ac5b9931c5532628')
File "C:\Program Files\Google\google_appengine\google\appengine\ext
\db\__init__.py", line 1178, in get
keys, multiple = datastore.NormalizeAndTypeCheckKeys(keys)
File "C:\Program Files\Google\google_appengine\google\appengine\api
\datastore.py", line 138, in NormalizeAndTypeCheckKeys
keys = [_GetCompleteKeyOrError(key) for key in keys]
File "C:\Program Files\Google\google_appengine\google\appengine\api
\datastore.py", line 2145, in _GetCompleteKeyOrError
key = Key(arg)
File "C:\Program Files\Google\google_appengine\google\appengine\api
\datastore_types.py", line 355, in __init__
raise datastore_errors.BadKeyError('Invalid string key %s.' %
encoded)
BadKeyError: Invalid string key
4d875b61d92411deba7f85ac5b9931c5532628==.
------
What could be the problem?
--deostroll
--
You received this message because you are subscribed to the Google Groups
"Google App Engine" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/google-appengine?hl=en.