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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T22:15:47+00:00 2026-06-05T22:15:47+00:00

try: html = urlopen(‘http://glbse.com/api/asset/’ + asset.name) except: print ‘error while updating the price of

  • 0
try:
    html = urlopen('http://glbse.com/api/asset/' + asset.name)
except:
    print 'error while updating the price of ' + asset.name
    continue
json_txt = html.read()
ticker = json.loads(json_txt)
average_price = int(ticker['t24havg'])
if average_price == 0:
    average_price = int(ticker['t5davg'])
if average_price == 0:
    average_price = int(ticker['t7davg'])
if average_price == 0:
    average_price = int(ticker['latest_trade'])
if average_price == 0:
    print 'could not determine the price of ' + asset.name
    continue
asset.average_price = average_price

I am using mechanize for urlopen.
This code (and the rest of the program) seems to run fine for hours but, after having looped through this section thousands of times, will eventually hang somewhere in this section of code.

It hangs for an indefinite length of time. I’ve even come back to it to find it had hung there for hours.

Googling the issue all I come up with are reports of a similar issue, where execution hangs on .read() which is reported to be fixed years ago.

So what is causing execution to hang and how can I fix or workaround it?

  • 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-06-05T22:15:48+00:00Added an answer on June 5, 2026 at 10:15 pm

    using mechanize.Browser().open() instead of urlopen reveals a “urllib2.URLError urlopen connection time out” which is not raised when using urlopen alone. I strongly suspect this is the problem and my solution is to use mechanize.Browser().open() in place of urlopen in all cases

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

Sidebar

Related Questions

For example http://twitter.github.com/bootstrap/base-css.html try to scroll up. You will see the bar with Typography
Try to download this page: http://www.4shared.com/get/B4AgMkcw/cookies.html I can use wget/firefox to get the whole
Please try this yourself :) ! curl http://www.windowsphone.com/en-US/apps?list=free the result is: <html><head><title>Object moved</title></head><body> <h2>Object
I'm using urllib2.urlopen() : req = urllib2.Request('http://www.google.com') resp = urllib2.urlopen(req) print resp.info() print resp.info()['set-cookie']
I try to use doctest from example from http://docs.python.org/library/doctest.html But when I run python
class FourSquareTestHandler(SecurePageHandler): def get(self): logging.info('***********************') logging.info('*****GET****') logging.info('***********************') try: request =\ urllib2.Request('https://api.foursquare.com/v2/users/self/checkins?oauth_token=LAF1W3VMSI0DGQYIBTNIYVIZG4VE2RFGESM45LDJRSQHFTK3&v=20120123') data = simplejson.load(urllib2.urlopen(request))
I am following this tutorial http://static.springsource.org/docs/Spring-MVC-step-by-step/part4.html to try and learn Spring. Everything worked fine
I use urllib2.urlopen(url) to get HTML content. The URL is http://127.0.0.1:8000/m.html/ . This method
I try to fetch a Wikipedia article with Python's urllib: f = urllib.urlopen(http://en.wikipedia.org/w/index.php?title=Albert_Einstein&printable=yes) s
http://www.dorsetdesigns.co.uk/contact.html try the form it wont send a email to me. i am using

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.