0

Hi Guys,

I'm new to python - how to execute dos2unix from python - subprocess.popen with shell = False ?

>>> cmd = subprocess.Popen(["dos2unix","./FEED1/bin/*"], stdout=subprocess.PIPE)
dos2unix: converting file ./FEED1/bin/* to UNIX format ...
>>> dos2unix: problems converting file ./FEED1/bin/*

All help appreciated.

3
Contributors
4
Replies
5
Views
5 Years
Discussion Span
Last Post by hencre
0

Probably with glob.glob

import glob
import subprocess
filelist = glob.glob("./FEED1/bin/*")
if filelist:
    cmd = subprocess.Popen(["dos2unix"] + filelist, stdout=subprocess.PIPE)

see also this snippet http://www.daniweb.com/software-development/python/code/257449

Sorry tht does not work for me

>>> cmd = subprocess.Popen(["dos2unix"]+filelist, stdout=subprocess.PIPE) dos2unix: converting file ./FEED1/bin/File1.pl to UNIX format ...
>>> dos2unix: problems converting file ./FEED1/bin/File1.pl

0

And the same command from xterm in the script directory works?

Edited by pyTony: n/a

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.