You Are Here:

Community: Developer Discussion Boards

#1 Old urllib and phone reboots - 2008-06-26, 16:35

Join Date: Apr 2008
Posts: 12
pantomas
Offline
Registered User
My application gets data from remote server with urllib:
Code:
usock=urllib.urlopen("http://111.10.12.12/chk.php?imei="+imei)
us=usock.read()
And it works fine.
However when I run this app a few times screen goes black and phone reboots.
After commenting out the above lines everything works with no problem.
Tested on two phones: E51 and E90.
Reply With Quote

#2 Old Re: urllib and phone reboots - 2008-06-26, 17:02

Join Date: Feb 2008
Posts: 2,542
Location: Bhavnagar, Gujarat, India
Send a message via Yahoo to gaba88 Send a message via Skype™ to gaba88
gaba88's Avatar
gaba88
Offline
Forum Nokia Champion
hi pantomas
can you tell the dibo what you are trying to read using
Code:
usock.read()
i think that may cause the problem.
waiting for your reply


Gargi Das- http://gargidas.blogsot.com

Forum Nokia Python Wiki


Learn Python at http://mobapps.org/PyS60
Reply With Quote

#3 Old Re: urllib and phone reboots - 2008-06-26, 18:03

Join Date: May 2007
Posts: 2,738
Location: 21.46 N 72.11 E
croozeus's Avatar
croozeus
Offline
Forum Nokia Champion
Quote:
Originally Posted by pantomas View Post
My application gets data from remote server with urllib:
Code:
usock=urllib.urlopen("http://111.10.12.12/chk.php?imei="+imei)
us=usock.read()
And it works fine.
However when I run this app a few times screen goes black and phone reboots.
After commenting out the above lines everything works with no problem.
Tested on two phones: E51 and E90.
The problem is with the URL that you are trying to read.

I tried to open this

http://111.10.12.12/chk.php?imei=123456789012345

I think you want to do a similar thing where the IMEI would be the last 15 digits in the URL.

My PC browser gives me the error
Quote:
The connection has timed out

The server at 111.10.12.12 is taking too long to respond.
and the phone browser tells me
Quote:
Connection timed out
Best Regards,
Croozeus
Reply With Quote

#4 Old Re: urllib and phone reboots - 2008-06-26, 18:28

Join Date: Apr 2008
Posts: 12
pantomas
Offline
Registered User
As I said it works fine. I can read data from server many times when this application is running. When I exit app and start it again it works fine again. I exit it and start again ad still it is working fine. Then I exit it and everything goes black and the phone reboots.
Exit means I exit the app and then I exit the python shell.

Python 1.4.2

croozeus: sorry I didn't mention it, this url is not real, I didn't want to expose real address

gaba88:
I tried three different codes (below) for data reading, they are working fine and as a result I get exactly the data the server is responding (it is a list: [21,122] )
The problem arise when I quit and run the app again

Code:
url="http://190.22.22.22/chk.php?imei="+imei
file="E:\\Python\\urltemp"
urllib.urlretrieve(url,file)
ff=open(file)
us=ff.read()
ff.close()
Code:
parms = urllib.urlencode({'param_1': 'value_1', 'param_2': 'value_2'})
# form contents
headers = {"Content-type": "application/x-www-form-urlencoded", "Accept": "text/plain"}
conn = httplib.HTTPConnection("190.33.33.33")
conn.request("POST", "/chk.php", parms, headers)
response = conn.getresponse()
us = response.read()
conn.close()
Reply With Quote

#5 Old Re: urllib and phone reboots - 2008-06-26, 18:47

Join Date: May 2007
Posts: 2,738
Location: 21.46 N 72.11 E
croozeus's Avatar
croozeus
Offline
Forum Nokia Champion
I can't really think of something that your doing, which makes the phone to reboot after several launches.

What else does your script contain? or only this code?

Best Regards,
Croozeus
Reply With Quote

#6 Old Re: urllib and phone reboots - 2008-06-26, 18:53

Join Date: Feb 2008
Posts: 2,542
Location: Bhavnagar, Gujarat, India
Send a message via Yahoo to gaba88 Send a message via Skype™ to gaba88
gaba88's Avatar
gaba88
Offline
Forum Nokia Champion
hi pantomas
sorry but i am also confused i am not getting the point why are you restarting the application.
or is it like your application runs only for one time and when you try to run it again it gets blank.


Gargi Das- http://gargidas.blogsot.com

Forum Nokia Python Wiki


Learn Python at http://mobapps.org/PyS60
Reply With Quote

#7 Old Re: urllib and phone reboots - 2008-06-26, 19:19

Join Date: Apr 2008
Posts: 12
pantomas
Offline
Registered User
In everyday use one don't keep applications running all the time. Say, web browser. When I want to check something on the web I start up browser but usually i quit it when it is no longer needed.
So in my case, this app I am working on allows you to be run three times and then for unknown reason your phone reboots.

Well, I am very surprised, it is not my first Symbian app.

The answer for croozeus question:
This is small business application that allows user to access some data from server to be edited on the phone. Really, nothing very complicated. Some menus, selection lists, local database.
As I said, when I remove the urllib code this problem doesn't show.

Maybe it has something to do with internet connection. There is no option to close it after retrieving data and it closes when I exit shell.
Last edited by pantomas : 2008-06-26 at 19:26. Reason: croozeus answer
Reply With Quote

#8 Old Re: urllib and phone reboots - 2008-06-27, 13:18

Join Date: Apr 2008
Posts: 12
pantomas
Offline
Registered User
This problem appears when using wlan connection.
With GPRS connection everything works fine.
Maybe it is some general problem in Symbian or in Python?
Reply With Quote

#9 Old Re: urllib and phone reboots - 2008-06-27, 13:37

Join Date: May 2004
Posts: 524
Location: Tampere, Finland
jethro.fn's Avatar
jethro.fn
Offline
Forum Nokia Champion
Quote:
Originally Posted by pantomas View Post
This problem appears when using wlan connection.
With GPRS connection everything works fine.
Maybe it is some general problem in Symbian or in Python?
Yeah. Sounds like a firmware bug. No Python application should be able to cause a device reset. Or it could be a massive memory leak in one of PyS60 modules, although Symbian OS usually catches those.
Reply With Quote
Reply « Previous Thread | Next Thread »
Display Modes
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Rate This Thread
Rate This Thread:

Posting Rules

You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump
Similar Threads
Thread Thread Starter Forum Replies Last Post
Cannot upload via urllib and read from bluetooth tristanr Python 2 2008-04-27 15:49
Sending a file from phone to webserver wissamch Python 3 2006-10-12 10:55
Memory leak within urllib, httplib and raw socket communications _welho_ Python 0 2006-02-20 12:51
Urllib petrikoppinen Python 1 2005-04-28 23:29

Rate This

 
Bookmark this page: DeliciousDiggFacebookGoogleYahooStumbleUponRedditDiigoTechnocratiTwitter  Share this page Share this page Print this Page Print this page Invite a friend Invite a friend
京ICP备05048969号    Email Newsletters Press Terms & Conditions Privacy Policy Sitemap Contact Us © 2009 Nokia