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

  • SEARCH
  • Home
  • 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 3243708
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T18:27:54+00:00 2026-05-17T18:27:54+00:00

I´m having trouble in creating a file and export to .yaml. I´m using Google

  • 0

I´m having trouble in creating a file and export to .yaml.
I´m using Google App Engine with Python 2.5.
Don´t understand the Yaml doc´s, it makes me confused.

What i want is to create a file and save it. It´s necessary to get entities from Models.

class SaveYAML(webapp.RequestHandler):
    def post(self):
        user = db.Query(models.User)
        user = user.filter('user =', users.get_current_user())
        users = user.fetch(limit = 1)

        for user in users:
            print(user.name, user.adress, user.phone, user.city)

        self.response.headers['Content-Type'] = 'application/yaml'
        self.response.headers['Content-Disposition'] = 'filename = myYaml.yaml' 

With this snippet i can view in a browser, when i click in a button the information retrieved from models.
Maybe it´s because of print method, but it doesn´t create a file
But when i upload my app to Google App Engine it doesn´t show the same info. It shows only ‘Status 200 Ok’.

Can someone point me in the right direction?
Do i have to import pyyaml library?

I changed some code to:

print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8epW0Ta5IdR1O7dTFDG5Eaeirj1xy3oG6dK7rQdGtvDuiQ2FuoCRLl2A+8x5J/OtFKKhtqZu
  MnPfQoajeXDeLtMtICfLG55cNj5Qp6/iVoqLQAb/AMQalqLDKoRBGf1NFceGqOpT9o+t/u6fgdNZ
  csuTt/T/ABMGTVb/AFu4NroW37H5rG5upEOB83AUHr9O/r2roI9DtfDsUt1GHmaTBmmc5kLdBz6d
  sdB246XrcIlpKgXaPNOOBz8wqtqkFxreoRWSKRp0ZJuJM43H+6PXPTPufw6DIytCk/0ttauQv2d8
  rbr3Ck8yKPQ9AP7oB7muk1m+S00We5VgVKfKQeDVe80yO3+eFAIO6gf6v6f7P8vpXP63lfsmnbnM
  c8ykoozhepIrlxk3Gi1Hd6L1ehrQinUV9lr92p0PhezNnoMAcfvJcyv9W5orWhKGFDEQU2jaR0xR
  XRCKhFRjsjOUnJuT6mALmOIyxujHMjE4478d6kXUUXIHnAZ/vH8e9FFUIY2roq8+dn03HH86wYby
  3bxFLduji3twYolxk5IyT196KKTipWv0GpNXsbNv4gtYZ/kEgjY/MpXoe5HP/wCv+ZRRTEf/2Q==
_name: !!python/unicode 'Ana Ferreira'
_parent: null
_parent_key: null
_adress: !!python/unicode 'Porto'
_phone: !!python/unicode '1234569789'
_user: *id002
None
Status: 200 OK
Cache-Control: no-cache
Content-Type: text/yaml
Content-Disposition: filename = myYaml.yaml
Expires: Fri, 01 Jan 1990 00:00:00 GMT
Content-Length: 0

Changed the code, but the data is only presented by browser.

  • 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-17T18:27:55+00:00Added an answer on May 17, 2026 at 6:27 pm

    Do not use print, use self.response.out.write(...).

    Yes, you will want to import yaml to output yaml, it will make it easier.

    Try this:

    import yaml
    
    users = model.Users.all().fetch(10)
    users = [{'user': {'name': user.name,
                       'address': user.address,
                       'phone': user.phone,
                       'city': user.city}}
              for user in users]
    
    self.response.out.write(yaml.dump(users, default_flow_style=False))
    

    You can check out the yaml docs for additional information on formatting the output.

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

Sidebar

Related Questions

I'm using LINQ to Entities (not LINQ to SQL) and I'm having trouble creating
I have a SQL query I'm having trouble creating using NHibernate Criteria: SELECT ID,
I'm having trouble creating a mouseover function with an NSTableView. The idea is that
I'm creating my own dictionary and I am having trouble implementing the TryGetValue function.
Having trouble linking the Stomp.framework into an iPhone SDK application. http://code.google.com/p/stompframework/ I follow the
Im having trouble using a .NET COM in vb6, It compiles ok and I
I having trouble in dividing the HTML frames. I have been using the following
I'm having trouble reading a chunked response when using a StreamReader to read the
We are having trouble getting Spring Security/Kerberos/AD to work for our web app. Our
I'm having trouble creating a UIView (in Interface Builder) that contains a UITableView with

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.