[BangPypers] DBF error

Ranganath s ranganaths at gmail.com
Thu Nov 19 11:54:23 CET 2009


HI all,

        i have installed the DBF module and  just wrote a small program as
follows :-
from dbfpy import dbf


def OpenFile(tblName):
       '''fpath = os.path.join(local.DB_DIR,tblName)'''
       '''f=open(tblName,"ab+")'''
       db=Dbf(tblName,True)
       db.addField(
           ("NAME","C",15),
           ("SName","C",15),
       )
       for(n ,s ) in (
          ("john","miller"),
       ):
          rec=db.newRecord()
          rec["NAME"]=n
          rec["SNAME"]=s
          rec.store()
       db.close()

OpenFile("test.dbf")

=============================
This programs gives error as follows
=============================
cursor at cursor:~/SchoolManagementSystem$ python test.py
Traceback (most recent call last):
  File "test.py", line 23, in <module>
    OpenFile("test.dbf")
  File "test.py", line 9, in OpenFile
    db=Dbf(tblName,True)
NameError: global name 'Dbf' is not defined
=================================================================

 Can some one point out like where am i going wrong.

Thank you
Ranganath.S




-- 
I blog at http://ranganaths.wordpress.com


More information about the BangPypers mailing list