-2

I am using a python package Molbery, A tool for Molecular biologists, the usage is like

molbery -o output_file_path input_path

I am working with python CGI script and want to have the above command to execute from the that CGI script. and then the resultant output of the output file would be displayed in a webpage

Maverick
  • 329
  • 1
  • 3
  • 12

2 Answers2

3

One way is to do it as a systems call:

from subprocess import call
call(["some_command ", "your_args"])

... or ...

import os
os.system("some_command your_args")

However usually, you can use the module directly by importing it and using it's functions and modules. I don't seem to find any documentation for this so the first thing I'd do is to look into the source code itself. Especially the entry point (i.e., main function/module).

Community
  • 1
  • 1
André C. Andersen
  • 7,351
  • 3
  • 43
  • 62
1

If I understand your question properly this should works for you

import os
os.system("molbery -o output_file_path input_path")

or this

from subprocess import call
call('molbery -o output_file_path input_path')

You can also see Calling an external command in Python

Community
  • 1
  • 1
Razik
  • 172
  • 5
  • 16