First problem I faced in PyS60

When I tried to connect to a website using Python from my mobile phone, I got into trouble. Every time I tried a simple program I got the following error message:

IOError:[Errno socket error](0, 'getaddrinfo failed')

Here is the code I tried:


import urllib

usock = urllib.urlopen("http://example.com")
data = usock.read()
usock.close()


I tried Google but couldn't find any good solution. Then I did some trial-n-error myself and got rid of the problem!
Actually when I connect to Internet from my mobile phone I have 3 access points - GP-WAP, GP-MMS and GP-Internet. When I browse from my mobile phone (it's Nokia N70), I use GP-WAP. So when the python program asked for the option I selected that and got the error. When I selected GP-Internet, I got rid of the problem.

Now I can connect the Internet using Python from mobile!!!

Comments

Unknown said…
Actually, you can use the GP-WAP connection, but PyS60, unlike JavaME, doesn't use Access Point proxy settings by default, you have to hardcode them.
Darren McEntee. said…
Hi there,

Maybe you can point me in the right direction as to what I might need for the following scenario on S60, if you are aware.

I wrote an application in Python some time ago, but for the desktop, not for mobile, that scrapped a web site for its structured characteristics, and logged into my personal account (to send text messages via the web) and performed various other tasks.

I would like to look into implementing it, this time on S60, so it can be done via my Nokia E51 mobile.

On my desktop version, I used a py lib called PAMIE, which is Python Automated Module For Internet Explorer, which preformed this functionality perfectly. its here: http://pamie.sourceforge.net/
This essentially allowed me to automate the browser by manipulating it's DocumentObject Model via COM.

This library is not available for s60, (as far as i can see) and would like to see what else is available.

If you know please let me know, or maybe I have other options?

Thanks for you time!

Best regards,
Darren. dmac -the at symbol- vodafone -dot- ie.
Alfie said…
do you know how to deal with "broken pipe" error in a connection like this?
I have a urllib code that works fine in the emulator but fails with "broken pipe" error on cell phone...

Popular posts from this blog

Strip HTML tags using Python

lambda magic to find prime numbers

Convert text to ASCII and ASCII to text - Python code