ok so i got the last part finished and working now for the bit i havent done before at all. instead of the pickle file the customer data has to be read in from a data base i have been supplied with the data base and the code but i dont know where in the code things have to put for example where i put all the data bae code.
also when i run the program i get this error
can any one help me here im very late with this program

C:/Python24/pythonw.exe -u "F:/soft dev 1/finished coursework/database template.py"
Traceback (most recent call last):
File "F:/soft dev 1/finished coursework/database template.py", line 1, in ?
import win32com.client
ImportError: No module named win32com.client

import win32com.client
import time
import datetime
import random

#Pin Validation
def pin():
 f=open("pins.pck", "r")
 pins = pickle.load(f)
 print
 print " ***Welcome to the bellco banking system***"
 print "============================================="
 print "Please insert your card"
 print ""
 print "Card Accepted"
 print ""
 pin = raw_input ("Please insert your pin number to the keypad: ")
 print "=============================================="
 
 #checks if pin is in dictionary 
 while True:
  if pin in pins.keys():
   pins= pins[pin]
   return pins #Stores pins details before passing them along
   break
  else:
   print "Invalid Pin"
   pin()
   break
   
  ##Checks if pin is within range of 1000 to 9999  
valid = 0
while not valid :
 if (pin > 999) and (pin < 10000) :
  print "Pin accepted"
  if pin== x:
   print "Valid Pin"
   valid = 1
  else :
   print "Invalid Pin"
   pin()
 else :
  print "pin must be between 1000 and 9999"
  pin()
  break
 
def getConnection():
 conn = win32com.client.Dispatch(r'ADODB.Connection')
 DSN = 'PROVIDER=Microsoft.Jet.OLEDB.4.0; DATA SOURCE=F:/customer.mdb;'
 conn.Open(DSN)
 return conn
def getRecordset():
 rs=win32com.client.Dispatch(r'ADODB.Recordset')
 return rs
def displayEmployees(rs, conn):
 rs.Open('select * from employees', conn)
 while not rs.EOF:
  #Fields displayed using field position in employee table
  print  rs.Fields.Item(1).Value, "  ", rs.Fields.Item(2).Value, "    " , rs.Fields.Item(3).Value
  rs.movenext
  
#Create Menu
def createmenu():
 messages = ["look out for any suspicious devices", "cover the keypad while entering your pin", "look over your shoulder, is the person behind you too close"]
 print " ***Welcome to Bank ATM*** "
 print "=================================="
 print " Please select one of the below "
 print " 1 Withdrawal only"
 print " 2 Withdrawal With Statement"
 print " 3 Statement only"
 print " 4 Quit"
 print "=================================="
 print random.shuffle(messages)
 print messages[0]
 print
 today = datetime.date.today()
 print "todays date is  ", today
 print "There are ", datetime.date(2007, 12, 25) - datetime.date.today(), "untill Christmas GET SAVING!!!!!!!"
#Statement Procedure
def statement(pins):
 today = datetime.date.today()
 print
 print pins[1]," ", pins[2]
 print "     ", today
 print "Your balance is $", pins[4] #balance details
 print
 print "Thank you for using this Bank ATM"
 print "=================================="
#Withdrawal Procedure
def withdrawal():
 
 print "================================"
 print " Please select one of the below "
 print " 1 $50"
 print " 2 $100"
 print " 3 $150"
 print " 4 $200"
 print "================================="
 amount= raw_input ("Please make your selection:")
 print "===================================="
 while True:
  if amount == "1":
   print "You have chosen to withdraw $50"
   print
   if pins[5] > 50:
    balance = pins[5] - 50
    pins[5] = balance
    print "Please take your cash"
    print "================================="
   else:
    print "insufficent funds"
   break
  #Insert coding to remove cash from balance
  elif amount == "2":
   print "You have chosen to withdraw $100"
   print
   if pins[5] > 100:
    balance = pins[5] - 100
    pins[5] = balance
    print "Please take your cash"
    print "================================="
   else:
    print "insufficent funds"
   break
   
  #Insert coding to remove cash from balance
  elif amount == "3":
   print "You have chosen to withdraw $150"
   print
   if pins[5] > 150:
    balance = pins[5] - 150
    pins[5] = balance
    print "Please take your cash"
    print "================================="
   else:
    print "insufficent funds"
   break
   
  #Insert coding to remove cash from balance
  elif amount == "4":
   print "You have chosen to withdraw $200"
   print
   if pins[5] > 200:
    balance = pins[4] - 200
    pins[4] = balance
    print "Please take your cash"
    print "================================="
   break
  else:
   print "Invalid Selection - Re-enter"
   withdrawal()
   break
  
#Menu Options
def selectoption(pins):
 keypadinput = raw_input ("Enter your selection: ")
 while True:
  if keypadinput == "1":
   print
   print "You have chosen to make a withdrawal"
   withdrawal()
   break
  elif keypadinput == "2":
   print
   print "You have chosen to make a withdrawal withdrawal with a statement"
   withdrawal()
   statement()
   break
  elif keypadinput == "3":
   print
   print "You have chosen to print a statement"
   statement(pins)
   break
  elif keypadinput == "4":
   print
   print "Thank you for using this Bank ATM"
   break
  else:
   print "Invalid Selection"
   selectoption()
   break
#Initiate Program
pins = pin()
createmenu()
selectoption(pins)

ImportError: No module named win32com.client

The error is more descriptive by itself, i.e, the module win32com is not available. So you can download the same and install.. then try importing the same. You can download the same from...
http://sourceforge.net/project/showfiles.php?group_id=78018

As far as query regarding database is concerned, I haven't gone through your code yet. Its for me to leave now.. I think somebody will answer that question.

kath.

This article has been dead for over six months. Start a new discussion instead.