954,510 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

Help with Python urllib module

Hi all,

I'm trying to use Python's urllib to get a Facebook profile page. I get the following error:

IOError: [Errno socket error] [Errno 10035] A non-blocking socket operation could not be completed immediately


Here's my code:

import urllib
member_profile_text = urllib.urlopen('http://www.facebook.com/profile.php?id=1073109649').read()


I need to get this working soon, so any help would be extremely appreciated.

Thanks so much!
Benjamin

VulcanDesign
Light Poster
46 posts since Jan 2010
Reputation Points: 10
Solved Threads: 5
 

Depending on the page you probably need to login to fb first before you can access that page.

predator78
Junior Poster
168 posts since Sep 2008
Reputation Points: 34
Solved Threads: 17
 

Works fine for me using Python27 on Windows7 OS.

vegaseat
DaniWeb's Hypocrite
Moderator
5,989 posts since Oct 2004
Reputation Points: 1,345
Solved Threads: 1,417
 

@ Vegaseat
That's really odd, it fails with the same error every time for me. I'm running Python 2.7 on Windows Vista. Also, I have a good internet connection.

@ predator78
I appreciate your response! It was a good idea. Unfortunately, it's not working for me.

Thanks for the responses so far!
Benjamin

VulcanDesign
Light Poster
46 posts since Jan 2010
Reputation Points: 10
Solved Threads: 5
 

It works for me on Slackware Linux as well. Are you behind a firewall?

woooee
Nearly a Posting Maven
2,454 posts since Dec 2006
Reputation Points: 777
Solved Threads: 714
 

Some security setting in Windows Vista could be the problem?

vegaseat
DaniWeb's Hypocrite
Moderator
5,989 posts since Oct 2004
Reputation Points: 1,345
Solved Threads: 1,417
 
Some security setting in Windows Vista could be the problem?

I doubt it, I've used this library before on same machine with same settings and met with success, I just can't figure out what's different here. Also, I can't find anything with my security system that would be blocking it....

VulcanDesign
Light Poster
46 posts since Jan 2010
Reputation Points: 10
Solved Threads: 5
 

I just ran the code in the IDLE and it worked just fine. No errors.
I am running Windows Vista, and I used Python 2.7.1

- WolfShield

WolfShield
Posting Whiz in Training
236 posts since Oct 2010
Reputation Points: 28
Solved Threads: 4
 

I just ran the code in the IDLE and it worked just fine. No errors. I am running Windows Vista, and I used Python 2.7.1

- WolfShield

Alright, I have confirmation. I'll stop checking my code and start on my firewall. Thanks for all your help people, WolfShield, Vegaseat, wooee, predator78. I really appreciate it.

Cheers!
Benjamin

VulcanDesign
Light Poster
46 posts since Jan 2010
Reputation Points: 10
Solved Threads: 5
 

This question has already been solved

Post: Markdown Syntax: Formatting Help
You
View similar articles that have also been tagged: