Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 891701
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T13:55:51+00:00 2026-05-15T13:55:51+00:00

Hey everyone. I am using Appengine/Python and I haven’t been able to fix a

  • 0

Hey everyone. I am using Appengine/Python and I haven’t been able to
fix a BadKeyError bug for the last 5 hours. I’m wondering if someone
can help me figure it out. The part of the app that is causing the bug
is a controller that processes votes done by users. Actor_id is the
key of the user and object_id is the key of the object that is being
voted on.

I’ve been testing the app by hiding and restoring some code, and I
know for sure that the keys being received are good (first block), and
that the entities are being created (second block). What does not work
is creating an activity instance – raises BadKeyError (third block)

I’ve added the controller code, the model code, and the traceback of
the error from the log page.

# Controller Code

class ActivityHandler(FacebookEnabled):
    def get(self):

        # i.e. fbid / headline id / upvote. This works
        actor_id = self.request.get('actor_id')
        object_id = self.request.get('object_id')

        # creating actor and object from keys (actor_id and object_id). 
        # This works.
        actor = models.Person.get(actor_id)
        object = models.Headline.get(object_id)
        logging.info("Actor " + str(actor) +": " + str(actor.name) +
           " object " + str(object) + ": " + str(object.title))

        # THIS IS WHAT SEEMS TO RAISE AN EXCEPTION
        activity = models.Activity(actor, object, action='upvote')
        activity.put()

# Model Code
class Activity(polymodel.PolyModel):
# User causing the action i.e. a person
    actor = db.ReferenceProperty(Person, required=True,
    collection_name='actors')

    # The object being the subject of the action i.e. headline
    object = db.ReferenceProperty(Headline, required=True,
        collection_name='objects')

    # The action being made
    action = db.StringProperty(required=True, choices=['upvote','downvote'],
         default='upvote')

Traceback

Name must be string type, not Headline
Traceback (most recent call last):
 File "/base/python_runtime/python_lib/versions/1/google/appengine/
ext/webapp/__init__.py", line 511, in __call__
   handler.get(*groups)
 File "/base/data/home/apps/libnentest/2.343063076026692316/main.py",
line 125, in get
   activity = models.Activity(actor, object, action='upvote')
 File "/base/python_runtime/python_lib/versions/1/google/appengine/
ext/db/__init__.py", line 726, in __init__
   key_name.__class__.__name__)
BadKeyError: Name must be string type, not Headline
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-15T13:55:52+00:00Added an answer on May 15, 2026 at 1:55 pm

    object is always a poor choice of name and could well be causing the exception.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 437k
  • Answers 437k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer Linq-to-SQL is a very easy to learn, easy to use… May 15, 2026 at 4:19 pm
  • Editorial Team
    Editorial Team added an answer Not possible. Maven checks the repositories in their declaration order… May 15, 2026 at 4:19 pm
  • Editorial Team
    Editorial Team added an answer EDIT2: Generics on superclasses and interfaces are not erased. You… May 15, 2026 at 4:19 pm

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.