This is a follow up question (not directly related, but maybe related in some way)
I am working with this code:
#! python3
# password.py - An insecure password locker program.
PASSWORDS = {'email': 'F7minlBDDuvMJuxESSKHFhTxFtjVB6',
'blog': 'VmALvQyKAxiVH5G8v01if1MLZF3sdt',
'luggage': '12345'}
import sys,pyperclip
if len(sys.argv) < 2:
print('Usage: python pw.py [account] - copy account password')
sys.exit()
account = sys.argv[1] # first command line arg is the account name
if account in PASSWORDS:
pyperclip.copy(PASSWORDS[account])
print('Password for ' + account + ' copied to clipboard.')
else:
print('There is no account named ' + account)
input('press ENTER to exit')
And trying to run it from the python.exe app. I have followed the guidlines from my textbook:
And created a .bat batch file with the following name:
@py.exe C:\PythonScripts\password.py %*
(C:\PythonScripts is my path)
So, my problem is:
When I double click the program (or win+R and type it the program) the window pops up for a split second. If for example I put
input("press enter to exit")
in the beginning, it ask me to press centre (once) and then the window vanishes. I know there is a problem in one of the steps I'm doing here because if I execute the program in the command prompt, it runs:
When I double click the icon password.py very quickly multiple times, this is the window that i'm talking about (that shows for a split second). If I put input("press enter")
in the beginning of my code, there will be the words "press enter" and i'll click enter to exit. But then the program doesn't seem to execute properly (the window closes immediately).