Re: homedir, file copy

2011-01-30 Thread Dave Angel
On 01/-10/-28163 02:59 PM, ecu_jon wrote: On Jan 30, 7:19 pm, Dave Angel wrote: On 01/-10/-28163 02:59 PM, ecu_jon wrote: ok now i get permission denied import os homedir =s.path.expanduser('~') try: from win32com.shell import shellcon, shell homedir =hell.SHGetFolderPath(0

Re: homedir, file copy

2011-01-30 Thread ecu_jon
On Jan 30, 8:25 pm, MRAB wrote: > On 31/01/2011 00:18, ecu_jon wrote: > > > > > On Jan 30, 7:09 pm, MRAB  wrote: > >> On 30/01/2011 23:43, ecu_jon wrote: > > >>> ok now i get permission denied > > >>> import os > >>> homedir = os.path.expanduser('~') > >>> try: > >>>       from win32com.shell

Re: homedir, file copy

2011-01-30 Thread MRAB
On 31/01/2011 00:18, ecu_jon wrote: On Jan 30, 7:09 pm, MRAB wrote: On 30/01/2011 23:43, ecu_jon wrote: ok now i get permission denied import os homedir = os.path.expanduser('~') try: from win32com.shell import shellcon, shell homedir = shell.SHGetFolderPath(0, shellcon.CSI

Re: homedir, file copy

2011-01-30 Thread Westley Martínez
It seems like you are trying to copy directories with shutil.copy. Use shutil.copytree instead. On Sun, 2011-01-30 at 16:43 -0800, ecu_jon wrote: > On Jan 30, 7:34 pm, rantingrick wrote: > > On Jan 30, 5:43 pm, ecu_jon wrote: > > > > > ok now i get permission denied > > > > [...] > > > > >

Re: homedir, file copy

2011-01-30 Thread ecu_jon
On Jan 30, 7:34 pm, rantingrick wrote: > On Jan 30, 5:43 pm, ecu_jon wrote: > > > ok now i get permission denied > > [...] > > > shutil.copy (backupdir1, backupdir2) > > I must stress the importance of proper testing before ever running > code that manipulates files! So many things can go wro

Re: homedir, file copy

2011-01-30 Thread rantingrick
On Jan 30, 5:43 pm, ecu_jon wrote: > ok now i get permission denied [...] > shutil.copy (backupdir1, backupdir2) I must stress the importance of proper testing before ever running code that manipulates files! So many things can go wrong. Of course you are just copying files here and not del

Re: homedir, file copy

2011-01-30 Thread ecu_jon
On Jan 30, 7:19 pm, Dave Angel wrote: > On 01/-10/-28163 02:59 PM, ecu_jon wrote: > > > ok now i get permission denied > > > import os > > homedir = os.path.expanduser('~') > > try: > >      from win32com.shell import shellcon, shell > >      homedir = shell.SHGetFolderPath(0, shellcon.CSIDL_A

Re: homedir, file copy

2011-01-30 Thread Dave Angel
On 01/-10/-28163 02:59 PM, ecu_jon wrote: ok now i get permission denied import os homedir = os.path.expanduser('~') try: from win32com.shell import shellcon, shell homedir = shell.SHGetFolderPath(0, shellcon.CSIDL_APPDATA, 0, 0) except ImportError: homedir = os.path.expandus

Re: homedir, file copy

2011-01-30 Thread ecu_jon
On Jan 30, 7:09 pm, MRAB wrote: > On 30/01/2011 23:43, ecu_jon wrote: > > > ok now i get permission denied > > > import os > > homedir = os.path.expanduser('~') > > try: > >      from win32com.shell import shellcon, shell > >      homedir = shell.SHGetFolderPath(0, shellcon.CSIDL_APPDATA, 0, 0

Re: homedir, file copy

2011-01-30 Thread MRAB
On 30/01/2011 23:43, ecu_jon wrote: ok now i get permission denied import os homedir = os.path.expanduser('~') try: from win32com.shell import shellcon, shell homedir = shell.SHGetFolderPath(0, shellcon.CSIDL_APPDATA, 0, 0) except ImportError: homedir = os.path.expanduser("~"

Re: homedir, file copy

2011-01-30 Thread ecu_jon
ok now i get permission denied import os homedir = os.path.expanduser('~') try: from win32com.shell import shellcon, shell homedir = shell.SHGetFolderPath(0, shellcon.CSIDL_APPDATA, 0, 0) except ImportError: homedir = os.path.expanduser("~") print homedir print os.listdir(homedir+

Re: homedir, file copy

2011-01-30 Thread rantingrick
On Jan 30, 5:13 pm, ecu_jon wrote: > what does this mean?  Use os.path.join(x,y, z*) > what is the x,y,z? x,y, and z in this case are just generic variables. Consider x+y=10. x and y could both equal 5 or any number of combinations of two numbers who sum equals ten. Anyway see the link chris pos

Re: homedir, file copy

2011-01-30 Thread Chris Rebert
On Sun, Jan 30, 2011 at 3:13 PM, ecu_jon wrote: > On Jan 30, 3:55 pm, r wrote: >> On Jan 30, 2:44 pm, ecu_jon wrote: >> >> > shutil.copy (homedir+"\\backup\\", homedir+"\\backup2\\") >> >> TIP: Use os.path.join(x,y, z*) >> >> > why is there still two \\ in the pathfor the copy command? >> >> I a

Re: homedir, file copy

2011-01-30 Thread ecu_jon
On Jan 30, 3:55 pm, r wrote: > On Jan 30, 2:44 pm, ecu_jon wrote: > > > shutil.copy (homedir+"\\backup\\", homedir+"\\backup2\\") > > TIP: Use os.path.join(x,y, z*) > > > why is there still two \\ in the pathfor the copy command? > > I always convert my paths to use a single '/' instead of '\\'.

Re: homedir, file copy

2011-01-30 Thread Chris Rebert
On Sun, Jan 30, 2011 at 12:44 PM, ecu_jon wrote: > hello, > i am trying to work with windows homedirectory as a starting point for > some kind of file copy command. i'm testing this on a win7 box so my > home is c:\Users\jon\ > here is the code snippet i am working on: > > import os > > homedir =

Re: homedir, file copy

2011-01-30 Thread r
On Jan 30, 2:44 pm, ecu_jon wrote: > shutil.copy (homedir+"\\backup\\", homedir+"\\backup2\\") TIP: Use os.path.join(x,y, z*) > why is there still two \\ in the pathfor the copy command? I always convert my paths to use a single '/' instead of '\\'. Just makes life that much easier! -- http:

homedir, file copy

2011-01-30 Thread ecu_jon
hello, i am trying to work with windows homedirectory as a starting point for some kind of file copy command. i'm testing this on a win7 box so my home is c:\Users\jon\ here is the code snippet i am working on: import os homedir = os.path.expanduser('~') try: from win32com.shell import shellc