You Are Here:

Community: Developer Discussion Boards

#1 Old save problem - 2008-08-18, 17:04

Join Date: Aug 2008
Posts: 148
cool_eagle
Offline
Regular Contributor
my application code:
Code:
.
.
.
.
.
.
f=open (c://a.txt','w')
fwrite(x)

but i see error'
f.write(x)
UnicodeError: ASCII encoding error: ordinal not in range (128)
how can i solve this problem
Reply With Quote

#2 Old Re: save problem - 2008-08-18, 17:06

Join Date: Oct 2007
Posts: 2,841
Location: Deva, Romania
bogdan.galiceanu's Avatar
bogdan.galiceanu
Offline
Forum Nokia Champion
Quote:
Originally Posted by cool_eagle View Post
my application code:
Code:
.
.
.
.
.
.
f=open (c://a.txt','w')
fwrite(x)

but i see error'
f.write(x)
UnicodeError: ASCII encoding error: ordinal not in range (128)
how can i solve this problem
Please provide the entire code. We have no way of guessing what value is assigned to x
Reply With Quote

#3 Old Re: save problem - 2008-08-18, 17:15

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 cooll_eagle
bogdan is correct that you have to post the whole code. BTW you can also try following sort of code:
Code:
    logfile = open('c://key.txt','a')
    logfile.write(f)
    logfile.close()
hope this helps
Enjoy Pythoning


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

Forum Nokia Python Wiki


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

#4 Old Re: save problem - 2008-08-18, 17:16

Join Date: Aug 2008
Posts: 148
cool_eagle
Offline
Regular Contributor
Code:
import contacts
db=contacts.open()
names=[db[r].title for r in db]
r=appuiwf.selection_list(names,search_field=1)
x=names[r]
f=open (c://a.txt','w')
fwrite(x)
now can u help
Reply With Quote

#5 Old Re: save problem - 2008-08-18, 17:21

Join Date: Oct 2007
Posts: 2,841
Location: Deva, Romania
bogdan.galiceanu's Avatar
bogdan.galiceanu
Offline
Forum Nokia Champion
Quote:
Originally Posted by cool_eagle View Post
Code:
import contacts
db=contacts.open()
names=[db[r].title for r in db]
r=appuiwf.selection_list(names,search_field=1)
x=names[r]
f=open (c://a.txt','w')
fwrite(x)
now can u help
That code, as you provided it, has no chance of working. You forgot to import appuifw, you wrote appuiwf instead of appuifw, you forgot an apostrophe before the file path and a dot between f and write(x).

This corrected version should work:
Code:
import contacts, appuifw
db=contacts.open()
names=[db[r].title for r in db]
r=appuifw.selection_list(names,search_field=1)
x=names[r]
f=open ('c://a.txt','w')
f.write(x)
f.close()
Reply With Quote

#6 Old Re: save problem - 2008-08-18, 17:21

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
Quote:
Originally Posted by cool_eagle View Post
Code:
import contacts
db=contacts.open()
names=[db[r].title for r in db]
r=appuiwf.selection_list(names,search_field=1)
x=names[r]
f=open (c://a.txt','w')
fwrite(x)
now can u help
hi cool_eagle
after ignoring all your typos hope they are actual typos and as you have opened a file you have to close it too so you have to add
Code:
f.close()


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

Forum Nokia Python Wiki


Learn Python at http://mobapps.org/PyS60
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
some problem in firmware 6680 V 5.04.07 man2007 General Symbian C++ 1 2007-01-26 18:36
About 6230 Bt Problem eerkek Bluetooth Technology 17 2005-02-08 13:33
Problem: Photo application. Works on Nokia 7650, not on 6600 andreas84 General Symbian C++ 1 2004-06-28 09:48
7210 Silent Problem MarkMckim Mobile Java General 1 2003-03-18 13:36
utf-8 problem when i save a file using notepad? simon3000 Browsing and Mark-ups 0 2002-06-13 11:51

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