Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #79975 > unrolled thread

Saving a file "in the background" -- How?

Started byVirgil Stokes <vs@it.uu.se>
First post2014-10-30 22:30 +0100
Last post2014-10-31 11:45 +1000
Articles 2 — 2 participants

Back to article view | Back to comp.lang.python


Contents

  Saving a file "in the background" -- How? Virgil Stokes <vs@it.uu.se> - 2014-10-30 22:30 +0100
    Re: Saving a file "in the background" -- How? Deepfriedice <Deepfriedice@openmailbox.org> - 2014-10-31 11:45 +1000

#79975 — Saving a file "in the background" -- How?

FromVirgil Stokes <vs@it.uu.se>
Date2014-10-30 22:30 +0100
SubjectSaving a file "in the background" -- How?
Message-ID<mailman.15332.1414706036.18130.python-list@python.org>
While running a python program I need to save some of the data that is 
being created. I would like to save the data to a file on a disk 
according to a periodical schedule  (e.g. every 10 minutes). Initially, 
the amount of data is small (< 1 MB) but after sometime the amount of 
data can be >10MB. If a problem occurs during data creation, then the 
user should be able to start over from the last successfully saved data.

For my particular application, no other file is being saved and the data 
should always replace (not be appended to) the previous data saved. It 
is important that  the data be saved without any obvious distraction to 
the user who is busy creating more data. That is, I would like to save 
the data "in the background".

What is a good method to perform this task using Python 2.7.8 on a Win32 
platform?

[toc] | [next] | [standalone]


#79987

FromDeepfriedice <Deepfriedice@openmailbox.org>
Date2014-10-31 11:45 +1000
Message-ID<m2upjs$bf8$1@speranza.aioe.org>
In reply to#79975
Why not just call the save function as a separate thread?
threading.Thread(target=save, args=(data)).start()

[toc] | [prev] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web