Re: Bug writing/reading to file.



text.txt is only read when you open the file, that means that your read
statement, doesnt now of what has been written to the file, since it was
opened..

under if if option == "1":
you should add, then it will be re-read for every read
abc = open('text.txt')
query = abc.readlines()

man, 24.12.2007 kl. 03.53 -0800, skrev arne.k.h@xxxxxxxxx:
Hi! :)

Im new to python, and I have made a electronic diary - its just a
task. Here is the code:
http://pastebin.com/m49391798

The bug is (feel free to download and test it) that i can't see what i
wrote in the diary without restarting the program. Here is an example:

1: I start the program
2: (text.txt is empty)
3: I write "hello, how are you?" with the writing-function in the
program
4; I use the read-all-function in the program.
5: There is no entries in the diary. But if I restart the program, I
can read the file.

The strange thing is that if i watch the file contents while im using
the program, I see that i add the line "hello, how are you?" to the
file, but i can't read it with the read-function.

Can this be a problem with file-pointers? And how can i solve it?
--
Lars Johansen <lj@xxxxx>
eZ Systems

.



Relevant Pages

  • Fwd: IBM HS21 cant run UBUNTU 7.10 and UBUNTU 8.0
    ... It doesnt give any error i didnt even saw the welcome screen or something, ... just as i finish restarting and also the bios screen, ... IBM HS21 cant run UBUNTU 7.10 and UBUNTU 8.0 ...
    (Ubuntu)
  • Re: IBM HS21 cant run UBUNTU 7.10 and UBUNTU 8.0
    ... It doesnt give any error i didnt even saw the welcome screen or something, ... just as i finish restarting and also the bios screen, ... John P. Combalicer ...
    (Ubuntu)
  • Is there anything I can run...
    ... To tell me why my laptop keeps restarting? ... I orignally thought it was heat related, but it doesnt get any hotter ... US, but when I brought it back, I've got a problem with it restarting ... The sound I can live without for the time being, ...
    (uk.comp.homebuilt)
  • Re: My comp restarts for no reason
    ... all this does is show the blue screen of death instead of restarting. ... doesnt solve the problem. ... only helps to see what driver or other is ... causing the problem. ...
    (microsoft.public.windowsxp.general)
  • Re: Computer Restarts when a DVD is inserted.
    ... If your system is clear of viruses, open Control Panel, open System, go to ... the system to blue screen instead of restarting on errors and the ... If you do not have an XP CD, you can download this application ... > reason when I put a DVD into my DVD drive my computer ...
    (microsoft.public.windowsxp.general)