I am trying to enter user name and password from command line. user name is 'example@gmail.com' and password is 'Example$319'.....When I am printing this values I can see the password is wrong. I am typing Example$319 but it is printing 'Example19'. $ and 3 are discarded.....Please help me what is going wrong.why it is not taking special character $?....Most of my passwords are having '$' sign. Please help.

__author__ = 'sujan'

import argparse
import sys

def main(argv):
    parser = argparse.ArgumentParser(description='Description of your program')
    parser.add_argument('-u', '--usr', help='UserName', required=True)
    parser.add_argument('-p', '--pswd',help='PassWord', required=True)
    args = vars(parser.parse_args())
    uname = args['usr']
    # code here

    password =  args['pswd']
    # code here

    if uname is None or password is None:
        print "User name - Password not valid"
        print uname
        print password
        print "calling program"

if __name__ == "__main__":

It works on windows.
python pro.py -u aaa -p Example$319
calling program

The shell you are using is interpreting your arguments. Try to escape the arguments with apostrophes (depending on the shell you are using).
Also the shebang (#!...) line should be int the first line.

it would be better not to use proscribed characters

The following printing ASCII characters are not used in Python. Their occurrence outside string literals and comments is an unconditional error:$ ?

$ is proscribed,
$0-$9 are used in python internal structure, if the executing program set $3, that value would be printed
As strings, they SHOULD be printing, is there anything elsewhere in the code that could cause the interpreter to assume the reference is to the internal variable
it could be as slates idea,
without the proper declaration in the first line the interpreter is throwing "spasms"

Try Example\$319. Your shell interpretes the $ sign in command lines before executing them.

I think there would have to be, given the interpreter's characteristics,
a prior step, to parse the password and change special characters
password.replace('?', '\?')
print uname
print password
print "calling program"
which would search the passwords for any qmark and hopefully render them printable
untested code scrap,

Blatant Plug portable python,
on my thumb drive
not affiliated with portable python in any way

Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.18 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.