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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T16:34:46+00:00 2026-05-15T16:34:46+00:00

I am getting the ApplicationError: 2 nonnumeric port: ” randomly for about 1/10th of

  • 0

I am getting the ApplicationError: 2 nonnumeric port: ” randomly for about 1/10th of my url request, the rest work fine, I seen this is a bug but I have yet to find any solutions, anyone have any thoughts in why this is occurring? I am running python 2.5.4 and google app engine 1.3.3

here is some generic code the error is occuring when requesting pages randomly

def overview(page):
     try:
          page = "http://www.url.com%s.json?" %page
          u = urllib.urlopen(page.encode('utf-8'))
          bytes = StringIO(u.read())
          u.close()
     except Exception, e:
          print e
          return None
     try:
        JSON_data = json.load(bytes)
        return JSON_data
     except ValueError:
        print "Couldn't get .json for %s" % page
        return None  
  • 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-15T16:34:46+00:00Added an answer on May 15, 2026 at 4:34 pm

    Couple of things with your code that could be problems. One is that you aren’t doing anything with the incoming value of page, but it is being over-written by the assignment fort thing inside your try block. Also, as I noted in my comment, the %s in the assignment wants to have a variable to substitute in its place. That’s probably what you are meant to to with the value coming in the page parameter. Try this:

    def overview(page_to_get):
         try:
              page = "http://www.url.com%s.json?" % page_to_get
              u = urllib.urlopen(page.encode('utf-8'))
              bytes = StringIO(u.read())
              u.close()
         except Exception, e:
              print e
              return None
         try:
            JSON_data = json.load(bytes)
            return JSON_data
         except ValueError:
            print "Couldn't get .json for %s" % page
            return None 
    

    EDIT:

    @user291071: I would guess that some of that values that are coming in through overview’s parameter page do not start with a leading slash. The only way to make sure that the URL parser doesn’t try to interpret the added-on information as a port-number is to make sure that it starts with a / or a ?. perhaps this will work better for you:

              page = "http://www.url.com/%s.json?" % page_to_get
    

    but it may cause other URLs that are currently working to fail. The best thing to do would be to log the URLs that are being created and visually inspect the ones that are failing.

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

Sidebar

Related Questions

Getting this. Site works fine locally, but up on production server I get this
Getting red warning message that expected identifier for this statement CALayer = ImageView.layer; Using
Getting this out of the way; I don't frequently do much in php or
Getting this weird LINQ error. title = System.Linq.Enumerable+WhereSelectEnumerableIterator`2[System.Xml.Linq.XElement,System.String Here is the code I have:
We keep getting this exception: Application_Error: Unhandled exception has been occured while requesting:/~/media/Flash Movies/nameoftheItem.ashx
Getting thrown into ColdFusion dev at work and just starting out, I wonder if
I keep getting this when I try hit the link of a website I
I am newbie in ZF and this is my first test. i am getting
Getting the following error, which I understand and have seen before. But one thing
I'm trying to deploy a Rails3 app to Heroku, but am getting this 'Rake

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.