Hey Danny and all, Alan's tutorial did help me, and showed me how to correctly load a file upon entry, and save upon exit. It should be smooth sailing from here on it.
Thank again, Nathan --- Original Message ----- From: "Danny Yoo" <[EMAIL PROTECTED]> To: "Nathan Pinno" <[EMAIL PROTECTED]> Cc: "Tutor mailing list" <tutor@python.org> Sent: Wednesday, August 03, 2005 8:45 PM Subject: Re: [Tutor] How do I fix the following error? Code and error message supplied. > > > On Wed, 3 Aug 2005, Nathan Pinno wrote: > >> Traceback (most recent call last): >> File "D:\Python24\password.py", line 82, in -toplevel- >> load_file(sitelist,filename) >> File "D:\Python24\password.py", line 51, in load_file >> [site,ID,passcard] = string.split(in_line,",") >> File "D:\Python24\lib\string.py", line 292, in split >> return s.split(sep, maxsplit) >> AttributeError: 'list' object has no attribute 'split' > > > Hi Nathan, > > Let's pay attention to the line 51 in your file: > >> [site,ID,passcard] = string.split(in_line,",") > > string.split() will fail if it is being given a set of arguments that it > doesn't understand. string.split() works only if in_line is a string. > > > But in the function load_file(), in_line is a list of strings. So there's > definitely a bug in load_file, in confusing the list of lines with a > particular single line. Actuallly, a lot of load_file() needs some > rework. > > > We strongly recommend you go through: > > http://www.freenetpages.co.uk/hp/alan.gauld/tutfiles.htm > > because the code that you're writing to handle the reading of files is > using a very old style of Python that hasn't been seen since the Python > 1.52 days; I suspect that you are learning from a very deprecated > tutorial! The approach that Alan takes in his "Learning How to Program" > tutorial uses a more modern, less bug-prone style of reading files. > > _______________________________________________ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor