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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T03:35:30+00:00 2026-05-27T03:35:30+00:00

I’m using boto in Python to automate some of my EC2 workflow. The issue

  • 0

I’m using boto in Python to automate some of my EC2 workflow.

The issue is very strange – the script appears to freeze on an assignment of a simple variable, but it is continuing in the background. Eventually the script prints everything out.

When I repeat the script line by line in iPython there are no problems and no freezing or waiting (beyond what you expect when talking the AWS). The output just seems to freeze when I run it as a Python script, until the script is complete.

The script:

def deploy_web_db_ami(a_key, a_pri, db_vol_id, db_vol_zone, db_vol_mnt):
    '''deploys a fresh instance for using as the web / db server.  
    '''

    #Connect to the EC2
    print "Connecting to AWS"
    conn = EC2Connection(a_key, a_pri)

    # get a ref to the image we want to install
    print "Searching for desired AMI image"
    image = conn.get_all_images(image_ids='ami-fd589594')


    print "Spinning up instance. . ."
    # Launch the image using our desired settings.
    reservation = image[0].run(key_name='my_kp', 
                               security_groups=['ssh'],
                               instance_type='t1.micro)
    print("we get this far before output freezes")
    ins = reservation.instances[0]


    print "Waiting for instance to move from pending to running. ",
    while (ins.state.lower() == u'pending'):
        print ". ",
        ins.update()
        time.sleep(5)

    time.sleep(5) # in case ssh is not up yet
    print "Instance %s's state changed to: %s" (ins.id, ins.state)
    if ins.state.lower() == u'running':
        # instance is up and running
        # Attach the db EBS volume
        print "Attaching DB EBS volume."
        conn.attach_volume(db_vol_id, ins.id, db_vol_mnt)
        p_dns = ins.dns_name
    else:
        print "ERROR - INSTANCE NOT RUNNING.:: %s" % ins.state

    print "All done!"
    return (ins.id, p_dns)

def total_web_deploy():
    deploy_web_db_ami('xxx', 'xxx', 'the id', 'the zone', '/mnt/sdf')
    some_other_functions(). .. 

I’m running the script from the command line using fab total_web_deploy

The output will look like this:

Connecting to AWS
Search for desired AMI image
Spinning up instance. . .
we get this far before output freezes

Then we will have to wait for the instance and everything to be finished before the rest of the script prints out. It’s clearly been working away in the background though.

Waiting for instance to move from pending to running.  .  .  .  .  .  .  .  .  .  .  Instance i-95c389f6's state changed to: running
Attaching DB EBS volume.
All done!

Any ideas?

EDIT I’ve clarified the question.

  • 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-27T03:35:31+00:00Added an answer on May 27, 2026 at 3:35 am

    Perhaps your output is being buffered.

    Try writing directly to stderr in order to rule that out:

    import sys
    sys.stderr.write("Equivalent message here\n")
    

    Or:

    import sys
    sys.stdout.write("Equivalent message here\n")
    sys.stdout.flush()
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm new to using the Perl treebuilder module for HTML parsing and can't figure
That's pretty much it. I'm using Nokogiri to scrape a web page what has
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have just tried to save a simple *.rtf file with some websites and
For some reason, after submitting a string like this Jack’s Spindle from a text
I'm using v2.0 of ClassTextile.php, with the following call: $testimonial_text = $textile->TextileRestricted($_POST['testimonial']); ... and
We're building an app, our first using Rails 3, and we're having to build
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
We are using XSLT to translate a RIXML file to XML. Our RIXML contains
I am reading a book about Javascript and jQuery and using one of the

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.