Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #52586
| From | Roy Smith <roy@panix.com> |
|---|---|
| Newsgroups | comp.lang.python |
| Subject | Re: How to I do this in Python ? |
| Date | 2013-08-16 07:47 -0400 |
| Organization | PANIX Public Access Internet and UNIX, NYC |
| Message-ID | <roy-C7472E.07470816082013@news.panix.com> (permalink) |
| References | <mailman.614.1376636762.1251.python-list@python.org> |
In article <mailman.614.1376636762.1251.python-list@python.org>, Ganesh Pal <ganesh1pal@gmail.com> wrote: > # Creating sparse files in the sparse path > sparse_path = os.path.join(path,'sparsefiles') > os.makedirs(sparse_path) > os.chdir(sparse_path) > sparsefiles = "dd if=/dev/zero of=sp1 count=0 bs=1 seek=10G" > process_0 = subprocess.Popen(sparsefiles, stdout=subprocess.PIPE, > stderr=subprocess.PIPE, shell=True) There is no need to shell out to dd just to do this. All dd is doing for you is seeking to the offset you specify and closing the file. You can do that entirely in Python code. http://docs.python.org/2.7/library/stdtypes.html#file.seek
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
How to I do this in Python ? Ganesh Pal <ganesh1pal@gmail.com> - 2013-08-16 11:51 +0530
Re: How to I do this in Python ? Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2013-08-16 10:59 +0000
Re: How to I do this in Python ? Ganesh Pal <ganesh1pal@gmail.com> - 2013-08-18 22:36 +0530
Re: How to I do this in Python ? Steven D'Aprano <steve@pearwood.info> - 2013-08-19 07:27 +0000
Re: How to I do this in Python ? Ganesh Pal <ganesh1pal@gmail.com> - 2013-08-28 10:10 +0530
Re: How to I do this in Python ? Roy Smith <roy@panix.com> - 2013-08-16 07:47 -0400
Re: How to I do this in Python ? random832@fastmail.us - 2013-08-16 14:17 -0400
csiph-web