【发布时间】:2013-10-01 06:09:17
【问题描述】:
我需要从控制台输入用户名和密码。对于我使用的密码
password = getpass.getpass('Enter password')
我用过import getpass 但是得到了
ImportError : no module named getpass
还尝试使用设置 pythonpath
export pythonpath=/usr/lib/python2.4/site-packages:/usr/lib/python2.4
代码:
#!/usr/bin/python2.4
import sys
import getpass
WL_USER = raw_input('Enter the username to login to BI EM:')
WL_PASSWD = getpass.getpass('Enter the password:')
HOST_NAME = raw_input('Enter the BI host URL')
WL_PORT = raw_input('Enter the admin port for BI')
错误:
ImportError: no module named getpass
一个重要的事情是我正在尝试将脚本作为 wlst 脚本运行,即尝试编辑 Mbean 的属性。所以执行是这样的: /home/wlserver_10.3/common/bin/wlst.sh test.py
我尝试将脚本作为 python test.py 执行 它执行得很好。所以看起来 wlst 有一些问题。 在这方面需要帮助。
【问题讨论】:
-
你的系统中有
/usr/lib/python2.4/getpass.py吗? -
No /usr/lib/python2.4 只有站点包作为子文件夹
-
听起来你的 Python 安装坏了——重新安装吧。
标签: python weblogic importerror wlst