On Thu, Nov 19, 2009 at 4:24 PM, Ranganath s <[email protected]> wrote:

> 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
> =============================
> cur...@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
> =================================================================
>

 Dbf != dbf

 You are importing module as "dbf" so how do you expect name "Dbf"
  to be there ?

 These are silly errors. If you need to post to a forum for resolving them,
 there is something wrong with your way of coding.


>
>  Can some one point out like where am i going wrong.
>
> Thank you
> Ranganath.S
>
>
>
>
> --
> I blog at http://ranganaths.wordpress.com
> _______________________________________________
> BangPypers mailing list
> [email protected]
> http://mail.python.org/mailman/listinfo/bangpypers
>



-- 
--Anand
_______________________________________________
BangPypers mailing list
[email protected]
http://mail.python.org/mailman/listinfo/bangpypers

Reply via email to