Re: sync databse table based on current directory data without losign previous values

2013-03-06 Thread nagia . retsina
Τη Τετάρτη, 6 Μαρτίου 2013 4:04:26 μ.μ. UTC+2, ο χρήστης Michael Ross έγραψε: > On Wed, 06 Mar 2013 12:52:00 +0100, Mark Lawrence > > wrote: > > > > > On 06/03/2013 07:45, Νίκος Γκρ33κ wrote: > > >> I'am using this snipper to read a current directory and insert all > > >> filenames into

Re: sync databse table based on current directory data without losign previous values

2013-03-06 Thread Lele Gaifax
Dave Angel writes: >># Compute a set of current fullpaths >>current_fullpaths = set() >>for root, dirs, files in os.walk(path): >> for fullpath in files: > > 'fullpath' is a rather misleading name to use, since the 'files' list > contains only the terminal node of the file name.

Re: sync databse table based on current directory data without losign previous values

2013-03-06 Thread Michael Ross
On Wed, 06 Mar 2013 12:52:00 +0100, Mark Lawrence wrote: On 06/03/2013 07:45, Νίκος Γκρ33κ wrote: I'am using this snipper to read a current directory and insert all filenames into a databse and then display them. But what happens when files are get removed form the directory? The inserted

Re: sync databse table based on current directory data without losign previous values

2013-03-06 Thread Chris Angelico
On Wed, Mar 6, 2013 at 10:52 PM, Mark Lawrence wrote: > On 06/03/2013 07:45, Νίκος Γκρ33κ wrote: >> blah blah blah >> blah blah blah >> blah blah blah > You were told yesterday at least twice that os.walk returns a tuple but you > still insist on refusing to take any notice of our replies when it

Re: sync databse table based on current directory data without losign previous values

2013-03-06 Thread Dave Angel
On 03/06/2013 05:27 AM, Lele Gaifax wrote: Νίκος Γκρ33κ writes: Its about the following line of code: current_fullpaths.add( os.path.join(root, files) ) I'm sorry, typo on my part. That should have been "fullpath", not "file" (and neither "files" as you wrongly reported back!): # Compu

Re: sync databse table based on current directory data without losign previous values

2013-03-06 Thread Mark Lawrence
On 06/03/2013 07:45, Νίκος Γκρ33κ wrote: I'am using this snipper to read a current directory and insert all filenames into a databse and then display them. But what happens when files are get removed form the directory? The inserted records into databse remain. How can i update the databse to

Re: sync databse table based on current directory data without losign previous values

2013-03-06 Thread Lele Gaifax
Νίκος Γκρ33κ writes: > Its about the following line of code: > > current_fullpaths.add( os.path.join(root, files) ) I'm sorry, typo on my part. That should have been "fullpath", not "file" (and neither "files" as you wrongly reported back!): # Compute a set of current fullpaths current_fu

Re: sync databse table based on current directory data without losign previous values

2013-03-06 Thread Bryan Devaney
On Wednesday, March 6, 2013 9:43:34 AM UTC, Νίκος Γκρ33κ wrote: > Perhaps because my filenames is in greek letters that thsi error is presented > but i'am not sure. > > > > Maybe we can join root+files and store it to the set() someway differenyl well, the error refers to the line "if

Re: sync databse table based on current directory data without losign previous values

2013-03-06 Thread Νίκος Γκρ33κ
Perhaps because my filenames is in greek letters that thsi error is presented but i'am not sure. Maybe we can join root+files and store it to the set() someway differenyl -- http://mail.python.org/mailman/listinfo/python-list

Re: sync databse table based on current directory data without losign previous values

2013-03-06 Thread Νίκος Γκρ33κ
Its about the following line of code: current_fullpaths.add( os.path.join(root, files) ) that presents the following error: : 'list' object has no attribute 'startswith' args = ("'list' object has no attribute 'startswith'",) message = "'list' object has no attribute 'startswith'"

Re: sync databse table based on current directory data without losign previous values

2013-03-06 Thread Lele Gaifax
Νίκος Γκρ33κ writes: > Thank you very much for making things clear to me!! You're welcome, even more if you spend 1 second to trim your answers removing unneeded citation :-) > > But there is a slight problem when iam trying to run the code iam presenting > this error ehre you can see its outp

Re: sync databse table based on current directory data without losign previous values

2013-03-06 Thread Νίκος Γκρ33κ
Τη Τετάρτη, 6 Μαρτίου 2013 10:19:06 π.μ. UTC+2, ο χρήστης Lele Gaifax έγραψε: > Νίκος Γκρ33κ writes: > > > > > How can i update the databse to only contain the existing filenames > > without losing the previous stored data? > > > > Basically you need to keep a list (or better, a set) conta

Re: sync databse table based on current directory data without losign previous values

2013-03-06 Thread Lele Gaifax
Νίκος Γκρ33κ writes: > How can i update the databse to only contain the existing filenames without > losing the previous stored data? Basically you need to keep a list (or better, a set) containing all current filenames that you are going to insert, and finally do another "inverse" loop where

sync databse table based on current directory data without losign previous values

2013-03-05 Thread Νίκος Γκρ33κ
I'am using this snipper to read a current directory and insert all filenames into a databse and then display them. But what happens when files are get removed form the directory? The inserted records into databse remain. How can i update the databse to only contain the existing filenames without