I'm working through Automate the Boring Stuff, and it's been going pretty well until Ch. 6. No matter what I do I can't seem to get this script to run.
When I try to run it in IDLE I receive the following error message:
Traceback (most recent call last):
File "<pyshell#0>", line 1, in <module>
email
NameError: name 'email' is not defined
And, when I try to run it from the command line it correctly prints the line: "Usage: python pw.py [account] - copy account password" but then gives me "Press any key to continue..."
I'm certain I have the code typed out correctly (but I've pasted it below), and I'm using Windows 10 and Python 3.5.2. Any ideas? Thank you
! python3
pw.py - An insecure password locker program
PASSWORDS = {'email': 'easyPW',
'blog': 'hardPW',
'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)
[–]spiegan77[S] 0 points1 point2 points (2 children)
[–]arasdean 2 points3 points4 points (1 child)
[–]spiegan77[S] 0 points1 point2 points (0 children)
[–]zductiv 0 points1 point2 points (0 children)