In article <mailman.614.1376636762.1251.python-l...@python.org>,
 Ganesh Pal <ganesh1...@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
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to