473,804 Members | 3,021 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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_nam e
print line[:-1]
else:
print line[:-1]
a.close()

update()

def update():
# Update the data base.
try:
from django.core.man agement 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 1105
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_nam e
print line[:-1]
else:
print line[:-1]
a.close()

update()

def update():
# Update the data base.
try:
from django.core.man agement 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
2204
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? Thanks.
5
9031
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 flushed data. But it is not clear, in the case of fflush(stdin), where stdin is default C keyboard buffer, what actually becomes of the data.
4
8205
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 TcpClient, NetworkStream and StreamWriter classes. but with low level socket it doesn't work (When using the Socket class Send method).
20
1966
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 *what* exactly gets flushed. Does the compiler some how determine the data that is accessible from that thread, and flush just that set? (Seems unlikely to me). Is it all data cached in registers etc? Or am I overthinking this and instead...
3
2052
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 (if sys.stdout is not line buffered). """#testexec.py import os
2
5425
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 Program { static void Main(string args) { FileInfo file = new FileInfo(@"E:\Demo\Log\20061214.log");
4
2246
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 example is a PEAR DB object; the question is the same for other ways of accessing the database): // Retrieve info if present $details = $db->getOne("SELECT contents FROM cache WHERE id=".$id." AND info='details'");
4
1743
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 buffer?
0
468
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 seek to the beginning after writing 8 bytes, and write some more bytes, you overwrite the original bytes. I don't believe there's any flush occurring on a seek...whether any buffers
0
10337
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10323
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10082
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9160
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7622
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5525
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4301
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3822
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2995
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.