0

While using the TreeTagger the following problem occured

import os
os.system("bin/tree-tagger lib/english-utf8.par inputfile outputfile")

The snippet above works in the command line. But when I try to execute it in a python code, nothing is written in the output file even though any error is given.

dtell
  • 2,488
  • 1
  • 14
  • 29
Ganchimeg
  • 51
  • 7

1 Answers1

0

This is the way I used cmd to include a command line within a programme I wrote a while ago in python 2.7. Obviously you will have to change for your type of data.

`import sys, os, subprocess
def velvet_assembly(fastqs,output):

    #cmd is a command line within the programme#
    cmd=['velveth', output, '59', '-fastq.gz', '-shortPaired',fastqs[0],fastqs[1]]
    my_file=subprocess.Popen(cmd)
    my_file.wait()
velvet_assembly(fastqs,output)`

In this link you can get some other examples. [https://www.cyberciti.biz/faq/python-run-external-command-and-get-output/][1]

Hope this is useful.

Ana
  • 131
  • 1
  • 14