473,320 Members | 1,988 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

Data not flushed at the moment

I've to modifying a file, then I use a method imported that access to
that file and has to read the new data, but they are not read ( as if
the data were not flushed at the moment even using .close()
explicitly).

---------------------------------------
...
...
# If it is not installed, it looking for the line and insert it.
if not is_application:
print "Activating I18n application ..."
writefile_line = 0
a = fileinput.input(settings, inplace=1)
# for line in fileinput.input(settings, inplace=1):
for line in a:
writefile_line += 1
if writefile_line == readfile_line:
print " '%s'," % application_name
print line[:-1]
else:
print line[:-1]
a.close()

update()

def update():
# Update the data base.
try:
from django.core.management import syncdb
except ImportError, err:
print "Can't import from Django: %s" % err
sys.exit(1)

syncdb()
---------------------------------------

Note that it only fails if the update() method is run inner of 'if not
is_application', and I don't understand because it is happening so. But
the problem is that I need run it when that condition is performed. Any
idea?

Nov 22 '06 #1
1 1086
Here it's very well explained:
http://groups.google.com/group/djang...cb01ec38e7e6cd

syncdb() method:
http://code.djangoproject.com/browse...gement.py#L435

But I'm not sure if is a django problem or from python.
MindClass ha escrito:
I've to modifying a file, then I use a method imported that access to
that file and has to read the new data, but they are not read ( as if
the data were not flushed at the moment even using .close()
explicitly).

---------------------------------------
...
...
# If it is not installed, it looking for the line and insert it.
if not is_application:
print "Activating I18n application ..."
writefile_line = 0
a = fileinput.input(settings, inplace=1)
# for line in fileinput.input(settings, inplace=1):
for line in a:
writefile_line += 1
if writefile_line == readfile_line:
print " '%s'," % application_name
print line[:-1]
else:
print line[:-1]
a.close()

update()

def update():
# Update the data base.
try:
from django.core.management import syncdb
except ImportError, err:
print "Can't import from Django: %s" % err
sys.exit(1)

syncdb()
---------------------------------------

Note that it only fails if the update() method is run inner of 'if not
is_application', and I don't understand because it is happening so. But
the problem is that I need run it when that condition is performed. Any
idea?
Nov 22 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: Jason Heyes | last post by:
I am starting to worry about the performance of formatted read/write operations on data-redundant objects in my program.What can I do to improve this performance should it become an issue? ...
5
by: hugo27 | last post by:
hugo 27, Oct 9, 2004 Ref Docs: c.l.c FAQ article 12.26 . www.digitalmars.com sitemap.stdio.fflush Reading these Docs I understand that fflush does not summarily destroy or discard the...
4
by: yaron | last post by:
Hi, I have a problem when sending data over TCP socket from c# client to java server. the connection established ok, but i can't send data from c# client to java server. it's work ok with...
20
by: NOtcarvinSPAM | last post by:
Obviously wrapping a critical section around access to some set of shared state variables flushes any cached data, etc so that the threads involved don't see a stale copy. What I was wondering is...
3
by: Thomas Guettler | last post by:
Hi, I noticed, that sys.stout does not get flushed before the process is replaced. The last print statements (before execvp()) disappear. It only happens, if the output is redirected to a file...
2
by: Kevien Lee | last post by:
Hi , I had a strang problam ,when i use StreamWriter to append to a file,i found that if i don't close the StreamReader it couldn't write the data into file,the code as folllow that: class...
4
by: Markus | last post by:
Hello I use a table to cache some informations which need lots of resources to be composed. The first time the info is needed, it will be composed and written to the cache table ($db in the...
4
by: DR | last post by:
When using System.IO.FileStream, I write 8 bytes, then seek to the start of the file, does the 8 bytes get flushed on seek and the buffer become a readbuffer at that point instead of being a write...
0
by: Mark Salsbery [MVP] | last post by:
"DR" <softwareengineer98037@yahoo.comwrote in message news:Op0NyzR8IHA.1200@TK2MSFTNGP04.phx.gbl... If the filestream is opened for write access then it still keeps its write access. If you...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.