简体   繁体   中英

How to run command module avail using subprocess?

I want to call module avail and module laod during my python code using subprocess.call which is something like this.

    subprocess.call(['module avail calibre','&','module load calibre'])

But when I run this code it returns:

OSERROR (2, 'No such file or directory')

Any help regarding subprocess??

If you are trying to run this shell command:

$ module avail calibre & module load calibre

with subprocess try:

subprocess.call(['module','avail','calibre','&','module','load','calibre'])

or:

subprocess.call('module avail calibre & module load calibre',shell=True)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM