files,folders,paths

aspineux aspineux at gmail.com
Sun Feb 13 05:22:31 EST 2011


Without trying to understand your code, I see one difference

   if not os.path.isfile(destination+leftover+fname):

become

   if not os.path.isfile(destination+leftover):


Regards


On Feb 13, 11:06 am, ecu_jon <hayesjd... at yahoo.com> wrote:
> i have a samba server at home (acting as my test environment) with one
> of the 'shares' mounted as v: on my windows box. inside of that are 4
> folders week[1-4]. i have created c:\users\name\backup , and put a few
> files/folders in there to test with. please ignore the wxpython parts
> of the script, the last 1/3, that part is functional. initial test was
> looking good. (in the code, ver011 source1, destination1) coping files/
> folders and not clobbering files. going to version 12a, it seems like
> it is trying to copy the files under the folder, before making the
> folder. or doing the copy2 part before the copytree part. i dont know
> why it works on ver011, and not in ver12a, the only difference being
> the destination.
> <a href="http://thanksforallthefish.endofinternet.net/
> facbac-011.py">facbac 011</a>
> <a href="http://thanksforallthefish.endofinternet.net/
> facbac-012a.py">facbac 012a</a>
> Traceback (most recent call last):
>   File "I:\college\spring11\capstone-project\facbac-012a.py", line
> 161, in button1Click
>     backupall()
>   File "I:\college\spring11\capstone-project\facbac-012a.py", line 81,
> in backupall
>     shutil.copy2(filesource, filedest1)
>   File "C:\Python27\lib\shutil.py", line 127, in copy2
>     copyfile(src, dst)
>   File "C:\Python27\lib\shutil.py", line 82, in copyfile
>     with open(dst, 'wb') as fdst:
> IOError: [Errno 2] No such file or directory: 'V:\\week2\\configs\
> \apache2.conf'
>
> here, apache2.conf = c:\users\name\backup\config\apache2.conf
> trying to copy to v:\week2\config\apache2.conf
> but there is no v:\week2\config
> as it has not made the config folder yet
> i think the problem might be the \\ in the destination name.




More information about the Python-list mailing list