0

I am having trouble figuring this out. I want to module load an aligner-"bowtie" in this case. Below is a snippet of the code I have:

import subprocess
moduleCmd=['module', 'load','/modules/ogi-mbc/software/bowtie/bowtie2-2.2.4/bowtie2']
subprocess.Popen(moduleCmd,shell=True)

When I run my script, I am getting following message:

cmdModule.c(166):ERROR:11: Usage is 'module command  [arguments ...]

Modules Release 3.2.10 2012-12-21 (Copyright GNU GPL v2 1991):

Usage: module [ switches ] [ subcommand ] [subcommand-args ]`

The program is NOT loaded after running the script.

Testing a simple command with subprocess such as:

testCmd=['ls', '-l']
subprocess.Popen(testCmd,shell=True)

I get the expected output.

2
  • Please update your answer and format your code properly with the built in editor tools. Also, please add an explanation of what you expect the code to do as well as the result you're getting. Commented May 29, 2017 at 1:14
  • 1
    Possible duplicate of Why subprocess.Popen doesn't work when args is sequence?, and a bunch of other SO questions. Commented May 29, 2017 at 2:02

1 Answer 1

0

Getting a cue from [link] (Loading environment modules within a python script)

Following worked: cmd=os.popen("/usr/bin/modulecmd python load bowtie/2.2.4) exec(cmd))

Incase others face the same issue, as nothing else was working.

NOTE: using python/2.7.3, also others environment modules worked for other tools as well.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.