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 4327726
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T09:34:45+00:00 2026-05-21T09:34:45+00:00

I have created a Google AppEngine Project which takes in a .txt file, finds

  • 0

I have created a Google AppEngine Project which takes in a .txt file, finds locations within the file and uses Yahoo Placemaker to plot a maker on the map to represent the .txt file.
The project works fine when I run in on my localhost but when I try and upload it to appspot I get an error:

BadValueError: Property lat must be a float

My main.py looks like this:

class Story(db.Model):
    id = db.StringProperty()
    loc_name = db.StringProperty()
    title = db.StringProperty()
    lat = db.FloatProperty()
    long = db.FloatProperty()
    link = db.StringProperty()

class MyStories(webapp.RequestHandler):
    def get(self):
        temp = db.Query(Story)
        temp = temp.count()


        story_set = Story.all()

        template_values = {
            'storyTemp': story_set
        }

        path = os.path.join(os.path.dirname(__file__), 'index.html')
        self.response.out.write(template.render(path, template_values))

class place(webapp.RequestHandler):
    def get(self):
        path = '/Users/kimmasterson/storing/txtFiles'

           try:
            for infile in glob.glob(os.path.join(path, '*.txt')):
                    #print infile
                    f = open(infile, 'r')
                    data = f.read()
                    newfile = infile.replace('.txt', '')
                    newfile = newfile.replace('/Users/kimmasterson/storing/txtFiles/', '')
                    #print newfile
                    storyname = 'http://www.independent.ie/national-news/' + newfile
                    #print storyname
                    #print newfile
                    #logging.info(data)
                    p = placemaker('HSnG9pPV34EUBcexz.tDYuSrZ8Hnp.LowswI7TxreF8sXrdpVyVIKB4uPGXBYOA9VjjF1Ca42ipd_KhdJsKYjI5cXRo0eJM-')
                    print p.find_places(data)
                    for place in p.places:
                        splitted = place.name.split()
                        for word in splitted:
                            temp = db.Query(Story)
                            temp = temp.filter("link = ", storyname)
                            results = temp.fetch(limit=1)
                            if len(results) >0:
                                break
                            elif 'IE' in word:
                                print temp
                                print 'success'
                                story = Story(name=newfile, lat=place.centroid.latitude, long=place.centroid.longitude, link=storyname, loc_name = place.name, title = newfile).put()
        except:
            print 'error'
            logging.info('BIG FAT ERROR')

def main():
    application = webapp.WSGIApplication([('/', MyStories), ('/place', place)],
                                         debug=True)

    wsgiref.handlers.CGIHandler().run(application)


if __name__ == '__main__':
    main()

My cron.yaml:

cron:
- description: running place

  url: /place

  schedule: every day 10:00

For some reason it adds the places and links the file to the map on my localhost. Any ideas how the same code in both places can work in one and not in the other?

  • 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-21T09:34:46+00:00Added an answer on May 21, 2026 at 9:34 am

    The obvious answer is that lat (which you’re getting from place.centroid.latitude) isn’t a float. Try logging type(place.centroid.latitude) to see what type it is – my guess would be that it’s a string, and you’ll need to call float() on it to parse it.

    As @Thomas points out, you obviously can’t refer to a file on your local machine and expect it to work once uploaded to App Engine. Instead, put your static data inside your app’s root directory (or a subdirectory), and open it with a relative path. The easiest and most robust way to do that is like this:

    path = os.path.join(os.path.dirname(__file__), 'path/to/your/file')
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have created a google-app-engine java project in Eclipse using Google's Eclipse plugin. My
I have created a custom dialog for Visual Studio Setup Project using the steps
I have created a C# class file by using a XSD-file as an input.
I just created my first application for Google App Engines, which is called Hello
I have a gae application (created via GRAILS) which loaded up fine, though my
I created a google app engine project. I just successfully mapped it to a
I am coming back to an old Google App Engine project on which I
I have a google app engine project and i want to make my REST
How do I make a Groovy Google App Engine project in Eclipse? I have
I'm going through the Sharded Counters example in Java: http://code.google.com/appengine/articles/sharding_counters.html I have a question

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.