[Python] Not able to import getpass in python

Discussão em 'Python' iniciado por Stack, Novembro 25, 2024.

  1. Stack

    Stack Membro Participativo

    I have a requirement to input username and password from the console. For the password I am using

    password = getpass.getpass('Enter password')


    I have used import getpass But getting

    ImportError : no module named getpass


    Also tried setting the pythonpath using

    export pythonpath=/usr/lib/python2.4/site-packages:/usr/lib/python2.4


    Code:

    #!/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')


    error:

    ImportError: no module named getpass


    One important thing is that I am trying to run the script as a wlst script i.e. trying to edit the attribute of an Mbean. So the execution goes like this: /home/wlserver_10.3/common/bin/wlst.sh test.py

    I tried to execute the script as python test.py It executes fine. So it looks like there is some issue with wlst. Need assistance on this.

    Continue reading...

Compartilhe esta Página