×

Discussion Board

Results 1 to 3 of 3
  1. #1
    Registered User
    Join Date
    Jun 2009
    Posts
    4

    Unhappy Help! Writing file error

    I am running a small script on N95 which periodically write accelerometer and gps data to a file. I open the file at the beginning of the program and close it when it exits. But I have recurrent errors like this:

    Normally,data in the file will look like:

    accelerometer
    [(324,5,10),(323,-5,10),(224,5,-10),(344,10,10),(124,-5,10),(324,5,-10),(324,5,10)]

    but when I run the script for random several hours, at some point, the program crashes and I look into the file and see

    accelerometer
    [(324,5,10),(323,-5,10),(224,5,-10),(344,10,10),(124,-5,10),(324,5,-10),(324,5,

    apparently the writing the whole list is abrupted but I don't know what can cause this. I've had this problem for several days and it's really driving me crazy.

  2. #2
    Super Contributor
    Join Date
    Oct 2007
    Location
    Deva, Romania
    Posts
    3,471

    Re: Help! Writing file error

    Perhaps it would help if you posted the code.
    Last edited by bogdan.galiceanu; 2009-07-16 at 15:25. Reason: Typo

  3. #3
    Registered User
    Join Date
    Jun 2009
    Posts
    4

    Re: Help! Writing file error

    Very sorry that the code is now inside a 600-line script...The following is the portion where I write to the file intensively. It happens every 40 seconds.

    print >> f, time.ctime()
    print >> f, "gps"
    print >> f, gps_set

    print >> f, "length of sound_set"
    print >> f, len(sound_set)

    print >> f, "light"
    print >> f, light_set

    print >> f, "message"
    print >> f, message

    print >> f, "feeling"
    print >> f, feeling

    sen.disconnect()
    acceler_set=_acceler_set[:len(_acceler_set)]
    _acceler_set=[]
    init_acceler()

    print >> f, "accelerometer"
    print >> f, acceler_set

    print >> f, "\n"

    currently I just dump lots of data into the file. The middle part just tries to close the tilt sensor connection to a callback function which update the _acceler_set, make a copy of this set,empty _acceler_set and reconnect. From the file it seems that problem happens at "print >> f, acceler_set".

    One thing is I just leave file "f" on for hours no matter when the program writes to it or does something else. Does it have any safety implications?

Similar Threads

  1. Error with makesis.exe and creating the .pkg file
    By gramya87 in forum Symbian Tools & SDKs
    Replies: 7
    Last Post: 2007-10-10, 13:53
  2. Contacts fields order??
    By timatima in forum Symbian
    Replies: 1
    Last Post: 2007-06-08, 13:51
  3. C-code..unable to make sis
    By Symbian_Neil in forum Symbian
    Replies: 9
    Last Post: 2006-12-02, 07:55
  4. error LNK2001: Please Help
    By sourish_khan in forum Symbian
    Replies: 9
    Last Post: 2006-04-19, 11:16
  5. camera app compilation problems
    By basarim in forum Symbian Tools & SDKs
    Replies: 1
    Last Post: 2003-12-31, 18:16

Posting Permissions

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