| Server IP : 103.48.194.25 / Your IP : 216.73.217.123 Web Server : Apache/2.4.6 (CentOS) OpenSSL/1.0.2k-fips PHP/7.4.33 System : Linux VMHostDefault 3.10.0-1160.42.2.el7.x86_64 #1 SMP Tue Sep 7 14:49:57 UTC 2021 x86_64 User : sieuthimay ( 1016) PHP Version : 7.4.33 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /usr/share/Modules/init/ |
Upload File : |
import os, re, subprocess
if not os.environ.has_key('MODULEPATH'):
f = open(os.environ['MODULESHOME'] + "/init/.modulespath", "r")
path = []
for line in f.readlines():
line = re.sub("#.*$", '', line)
if line is not '':
path.append(line)
os.environ['MODULEPATH'] = ':'.join(path)
if not os.environ.has_key('LOADEDMODULES'):
os.environ['LOADEDMODULES'] = ''
def module(*args):
if type(args[0]) == type([]):
args = args[0]
else:
args = list(args)
(output, error) = subprocess.Popen(['/usr/bin/modulecmd', 'python'] +
args, stdout=subprocess.PIPE).communicate()
exec output