Python Forum
What do i have to type in the IDLE shell to use this password manager program?
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
What do i have to type in the IDLE shell to use this password manager program?
#1
Hi,

I am doing an assignment in a Python exercise book. I have to create a password manager program that can be used with a command line argument that is the account's name like 'email' or 'blog'. That account's password will be copied to the clipboard so that the user can paste it into a password field. My question is: How do i use this program? What do i have to type in the IDLE shell to show for example the password for 'email'? This is the program i wrote by following the stteps in the book. Any input is much appreciated!

#!
# pw.py - An insecure password locker program.
PASSWORDS={'email':'F97398uifhilh92',
           'blog':'kuhge987De87D',
           'luggage':'12345'}

import sys
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)
Reply
#2
You don't run programs using IDLE. You run them at your operating system's command line. Line 9 tells you how to run the program.
Reply
#3
check out python's getpass: https://docs.python.org/3/library/getpass.html
Reply
#4
As ndc85430 says, you run this from the command line as documented in line 9 of the code. Note that line 9 assumes you run Python programs using "python" and your program is in the current folder and is named "pw.py". Your situation may differ. If you use "python3" to run python programs and your program is in a subfolder of the current directory named "exercises" you might need to type "python3 exercises/pw.py email".
Reply
#5
Thanks for the info. It works.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  problem with help(type(self)) in Idle akbarza 1 497 Dec-26-2023, 12:31 PM
Last Post: Gribouillis
  Launch Python IDLE Shell from terminal Pavel_47 5 1,263 Feb-17-2023, 02:53 PM
Last Post: Pavel_47
  Can a program execute code in iPython shell and get result? deanhystad 3 1,760 Jun-17-2022, 03:45 AM
Last Post: Larz60+
  How to make a Python program run in a dos shell (cmd) Pedroski55 2 2,336 Nov-09-2020, 10:17 AM
Last Post: DeaD_EyE
  How to create an app manager _ShevaKadu 8 3,815 Nov-01-2020, 12:47 PM
Last Post: _ShevaKadu
  Redirect to __stdout__ fails in IDLE shell Pavel_47 1 1,970 Apr-13-2020, 05:13 PM
Last Post: deanhystad
  Python - change variable type during program execution ple 1 2,397 Apr-12-2020, 08:43 AM
Last Post: buran
  Type hinting - return type based on parameter micseydel 2 2,510 Jan-14-2020, 01:20 AM
Last Post: micseydel
  Beginner python password program jakobscheffler 4 5,064 Jan-23-2019, 08:14 PM
Last Post: Alfalfa
  IDLE not importing pygame (ok outside of IDLE) miner_tom 1 3,334 Sep-14-2018, 07:54 PM
Last Post: Larz60+

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020