Why urllib2 doesn't work for me?

69

one test you might first try is to isolate the network.

Fire up python -m SimpleHTTPServer, it creates a simple webserver in the current directory listening on port 8000.

Then you can test:

>>> import urllib2
>>> response = urllib2.urlopen("http://localhost:8000")
>>> response.msg
'OK'

This will let you know if your problem is in python, or if you are having network issues (which I suspect to be the case).

Share:
69

Related videos on Youtube

Ateeq
Author by

Ateeq

Updated on September 18, 2022

Comments

  • Ateeq
    Ateeq over 1 year

    I have a problem which is that I have a desktop application that is running fine in Visual Studio 2008, I create a setup project and I'm sure that I did it in a correct way exactly like the steps here.

    After I get the setup project it says it installed successfully however when I double click on the desktop shortcut nothing happens. Please note that I'm using .NET 2.0 and Windows 2000, I also have another version of this application that is using .NET 3.5 and it works fine on Windows 7 and any other Windows version that is compatible with .Net 3.5. Any idea as to what is happening?

    • 100rabh
      100rabh over 13 years
      Seems like your gateway settings are incorrect
    • db42
      db42 almost 13 years
    • Damien_The_Unbeliever
      Damien_The_Unbeliever over 10 years
      I thought people continuing to work on XP systems were crazy given that it's falling out of support in less than 6 months. But 2000?
    • Thorsten Dittmar
      Thorsten Dittmar over 10 years
      Well, what does the event log say? Is the application actually being copied to the desired installation location? What happens if you try to run it directly from the installation folder? What happens if you simply copy all the required files to the destination system and try to run that? Have you tried anything to find the cause of the problem yourself??
    • Ateeq
      Ateeq over 10 years
      Damien_The_Unbeliever , will this is the case I have !
    • Ateeq
      Ateeq over 10 years
      Thorsten Dittmar , I try to run it from the installation folder but it's same nothing works I'm trying to solve it since 2 weeks ! I have no idea what is causing the problem