IOError: [Errno 32] Broken pipe
- by khati
I got "IOError: [Errno 32] Broken pipe" while writing files in linux.
I am using python to read each line a of csv file and then write into a database table.
My code is
f = open(path,'r')
command = command to connect to database
p = Popen(command, shell=True, stdin=PIPE, stdout=PIPE, stderr=PIPE, env=env)
query = " COPY myTable( id, name, address) FROM STDIN WITH DELIMITER ';' CSV QUOTE '"'; "
p.stdin.write(query.encode('ascii')) *-->(Here exactly I got the error, p.stdin.write(query.encode('ascii'))
IOError: [Errno 32] Broken pipe )*
So when I run this program in linux, I got error "IOError: [Errno 32] Broken pipe" . However this works fine when I run in windows7.
Do I need to do some configuration in Linux sever?
Any suggestions will be appreciated.
Thank you.