Not sure why, but I would try to get rid of the “noise” around your command and check the return code:
check_call(["dos2unix",file1], stdout=f_null , stderr=subprocess.STDOUT)
- , ( !)
shell=True, dos2unixcheck_call,
, dos2unix , tty (dos2unix ). . , os.devnull , .
python- ( ), dos2unix ( Windows):
with open(file1,"rb") as f:
contents = f.read().replace(b"\r\n",b"\n")
with open(file1+".bak","wb") as f:
f.write(contents)
os.remove(file1)
os.rename(file1+".bak",file1)
, . ( ):
with open(file1,"rb") as fr, open(file1+".bak","wb") as fw:
for l in fr:
fw.write(l.replace(b"\r\n",b"\n"))
os.remove(file1)
os.rename(file1+".bak",file1)