Hi everyone,<br><br>In my program I have this code :<br><br><blockquote style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;" class="gmail_quote">self.run_cmd_0 = subprocess.Popen(self.cmd_0, stdout = subprocess.PIPE, shell = True)&nbsp;&nbsp;&nbsp;&nbsp; #(1)<br>
self.run_cmd_1 = subprocess.Popen(self.TOCOL, stdin = self.run_cmd_0.stdout, stdout = subprocess.PIPE, shell = True)&nbsp;&nbsp;&nbsp; #(2)<br>self.result_0 = StringIO.StringIO(self.run_cmd_1.communicate()[0])&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; #(3)</blockquote><div>
<br>(1) :&nbsp; executes cmd_0 as a subprocess with stdout to PIPE<br>(2) : executes cmd_1 a second process with stdin from the previouse cmd_0<br>(3) : Here I tried to use StringIO module to create a file object from stdout of cmd_1 : I need a file object because I have a mysql query later in my program to load it into the database : <br>
</div><br><blockquote style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;" class="gmail_quote">self.cmd_sql_2 = &quot;load data local infile &#39;%s&#39; into table statistics fields terminated by &#39;\t&#39; lines terminated by &#39;\n&#39;&quot; % self.FILE&nbsp;</blockquote>
<div><br>so self.cur.execute(self.cmd_sql_2) fails.<br>the problem is that&nbsp; mysql&nbsp; is expecting a REAL file for this query !! is there any pythonic way of avoiding to write to disk before loading into Mysql database ? some sort of in-memory file oject.<br>
<br>Thanks In Advance.<br></div>