The perl command is

perl /opt/translation/moses/scripts/tokenizer/tokenizer.perl -l en < Eng-hin.translation.en > Input/tokenization/Eng-hin.translation.tok.en

I want to execute the above perl command in python script ,Here the perl command is executed successfully in Popen() but no output file is created at location "Input/tokenization/Eng-hin.translation.tok.en".

var = "-l en  <   Input/Corpus/"+inputfilename+" > Input/tokenization/Eng-hin.translation.tok.en"
pipe = subprocess.Popen(["perl",
                         "/opt/translation/moses/scripts/tokenizer/tokenizer.perl",
                         var
                         ])

Can someone tell me whats happening behind ?

First, try it with "shell=True" (see the link below). And post which version of Python and the OS you are using.

You can capture the output and write it to a file yourself so you know if you are getting that far or not. See the Python Module of the Week's "capturing output" http://pymotw.com/2/subprocess/index.html#capturing-output (and subprocess.call should work just fine for calling/running the program).

The code you posted has one error that I can see, although we can not run it because we don't have the perl script. There a missing slash for the directory at the beginning of the output file i.e. should be "> /Input/tokenization/Eng-hin.translation.tok.en"

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.