I'm doing the following:
from subprocess import PIPE
from subprocess import Popen
file = 'dump.sql.gz'
p1 = Popen(["gzip", "-cd" ,file], stdout=PIPE)
print "Importing temporary file %s" % file
p2 = Popen(["mysql","--default-character-set=utf8", "--user=root" , "--password=something", "--host=localhost", "--port=3306" , 'my_db'],stdin=p1.stdout, stdout=PIPE,stderr=PIPE)
err = p1.communicate()[1]
if err: print err
err = p2.communicate()[1]
if err: print err
But the db is not being populated. No errors are shown, also I have checked p1.stdout and it has the file contents.
Any ideas?