Re: string to path problem

2011-04-04 Thread ecu_jon
On Apr 4, 5:06 am, Kushal Kumaran wrote: > On Mon, Apr 4, 2011 at 9:48 AM, ecu_jon wrote: > > On Apr 4, 12:17 am, Chris Rebert wrote: > >> On Sun, Apr 3, 2011 at 8:30 PM, ecu_jon wrote: > >> > i am writing a basic backup program for my school. so they wanted the

Re: string to path problem

2011-04-03 Thread ecu_jon
On Apr 4, 12:17 am, Chris Rebert wrote: > On Sun, Apr 3, 2011 at 8:30 PM, ecu_jon wrote: > > i am writing a basic backup program for my school. so they wanted the > > possibility to be able to set source/destination from a config file. > > my source/destination was fine bef

string to path problem

2011-04-03 Thread ecu_jon
i am writing a basic backup program for my school. so they wanted the possibility to be able to set source/destination from a config file. my source/destination was fine before, i would build it up with functions, like 1 that got the user-name, and put it all together with os.path.join. but if they

Re: python time

2011-03-20 Thread ecu_jon
i see. i was using time as a variable name , messing it all up.im not going to post the whole backup script here, but here are a few lines that i changed to make it work. from datetime import datetime from os.path import join, getsize import time,os,string,getpass,md5,ConfigParser from time import

Re: python time

2011-03-20 Thread ecu_jon
so then why does this not work ? from datetime import datetime from os.path import join, getsize import time,os,string,getpass,md5,ConfigParser from time import strftime,localtime config = ConfigParser.ConfigParser() config.read("config.ini") date = config.get("myvars", "date") time = config.get(

Re: python time

2011-03-20 Thread ecu_jon
On Mar 20, 10:48 pm, ecu_jon wrote: > On Mar 20, 10:09 pm, Dave Angel wrote: > > > > > On 01/-10/-28163 02:59 PM, ecu_jon wrote: > > > > I'm working on a script that will run all the time. at time specified > > > in a config file, will kick-off

Re: python time

2011-03-20 Thread ecu_jon
On Mar 20, 10:09 pm, Dave Angel wrote: > On 01/-10/-28163 02:59 PM, ecu_jon wrote: > > > > > I'm working on a script that will run all the time. at time specified > > in a config file, will kick-off a backup. > > problem is, its not actually starting the job.

python time

2011-03-20 Thread ecu_jon
I'm working on a script that will run all the time. at time specified in a config file, will kick-off a backup. problem is, its not actually starting the job. the double while loop runs, the first comparing date works. the second for hour/min does not. #python file import os,string,,time,getpass,C

Re: os.walk/list

2011-03-20 Thread ecu_jon
yes i agree breaking stuff into smaller chunks is a good way to do it. even were i to do something like def safe_copy() f1=file(files ,'rb') f2 = file(os.path.join(currentdir,fname,files)) truth = md5.new(f1.read()).digest() == md5.new(f2.read()).digest() if truth == 0:

os.walk/list

2011-03-19 Thread ecu_jon
so i am trying to add md5 checksum calc to my file copy stuff, to make sure the source and dest. are same file. i implemented it fine with the single file copy part. something like : for files in sourcepath: f1=file(files ,'rb') try: shutil.copy2(files, os.path.join(dest

Re: file/folder naming

2011-02-18 Thread ecu_jon
On Feb 19, 1:38 am, Steven D'Aprano wrote: > On Fri, 18 Feb 2011 22:13:42 -0800, ecu_jon wrote: > > ok changed the try/except to just a file copy and got this: > > sourcepath is : > > [u'I:\\college\\spring11\\capstone-project\\facbac-009.py'] > > Not

Re: file/folder naming

2011-02-18 Thread ecu_jon
ok changed the try/except to just a file copy and got this: sourcepath is : [u'I:\\college\\spring11\\capstone-project\ \facbac-009.py'] destpath is : V:\week3 destpath is : V:\week3\facbac-009.py Traceback (most recent call last): File "I:\college\spring11\capstone-project\folder.py", line 53, i

Re: file/folder naming

2011-02-18 Thread ecu_jon
On Feb 18, 11:59 pm, Chris Rebert wrote: > On Fri, Feb 18, 2011 at 8:29 PM, ecu_jon wrote: > > im trying to use wxpython to get a source file/files, then a > > destination folder to write them to. the file and folder picker works. > > the problem is, actually copying (

file/folder naming

2011-02-18 Thread ecu_jon
im trying to use wxpython to get a source file/files, then a destination folder to write them to. the file and folder picker works. the problem is, actually copying (actually shutil.copy2() ). i get an except error, as if the destination file name is not correct. looking at the print lines the dest

Re: files,folders,paths

2011-02-14 Thread ecu_jon
well i think i will close this out. redid recursive foldering now for 3rd or 4th time. below script works from a windows to another folder (destination1) or a unc path(destination2). i tried it on my linux box, and the error deals with writing to a remote smb share. i think if it was mounted somewh

Re: files,folders,paths

2011-02-14 Thread ecu_jon
On Feb 14, 4:43 am, Dave Angel wrote: > On 01/-10/-28163 02:59 PM, ecu_jon wrote: > > > > > this is a reply to both Dave Angel and Ben Finney. this version of > > testing i think incorperates what you guys are saying. > > http://thanksforallthefish.endofinternet.ne

Re: files,folders,paths

2011-02-14 Thread ecu_jon
On Feb 14, 4:43 am, Dave Angel wrote: > On 01/-10/-28163 02:59 PM, ecu_jon wrote: > > > > > this is a reply to both Dave Angel and Ben Finney. this version of > > testing i think incorperates what you guys are saying. > > http://thanksforallthefish.endofinternet.ne

Re: files,folders,paths

2011-02-14 Thread ecu_jon
i think i got it. my dirlist wasn't the right way to go, i needed to iterate thu what oswalk was giving me in dirs, and files. not bruteforce strip to a string. i have been starting at an early version and a later version for the last 4 hours or so, and i think i have it this only handles the folde

Re: files,folders,paths

2011-02-13 Thread ecu_jon
On Feb 14, 12:12 am, Ben Finney wrote: > ecu_jon writes: > > On Feb 13, 8:29 pm, Ben Finney wrote: > > > Instead, focus on the issue that's causing you confusion: > > > constructing a filesystem path and testing whether it exists. > > > > Make a *mi

Re: files,folders,paths

2011-02-13 Thread ecu_jon
this is a reply to both Dave Angel and Ben Finney. this version of testing i think incorperates what you guys are saying. http://thanksforallthefish.endofinternet.net/ testing1.py">testin1.py except maybe the os.join.path in the last function. here is the traceback Traceback (most recent call last)

Re: files,folders,paths

2011-02-13 Thread ecu_jon
On Feb 13, 8:48 pm, Dave Angel wrote: > (You forgot to include the list in your response, and you neglected to > properly quote the message you were replying to.  That makes it quite > hard to separate your remarks from mine) > > On 02/13/2011 07:19 PM, jon hayes wrote: > > > c:\users\name\backup\

Re: files,folders,paths

2011-02-13 Thread ecu_jon
On Feb 13, 8:29 pm, Ben Finney wrote: > ecu_jon writes: > > here take a look. > >http://thanksforallthefish.endofinternet.net/testing.py > > I think you're confusing yourself by shoving lots of experimental lines > into a large program and not isolating the problem

Re: files,folders,paths

2011-02-13 Thread ecu_jon
On Feb 13, 6:39 pm, Ben Finney wrote: > ecu_jon writes: > > can you give an example of how to build a folder name, maybe as a > > string, with parts of it as variables, that have to be strung > > together. like x = "//servername/+variable+"/"

Re: files,folders,paths

2011-02-13 Thread ecu_jon
On Feb 13, 5:11 pm, Tim Roberts wrote: > ecu_jon wrote: > > >i know backslashes are special. there a special pain in my #$%. > >without a windows environment, you would have to change destination2 > >significantly to try it out. but like i said above you can try

Re: files,folders,paths

2011-02-13 Thread ecu_jon
"Please don't dump code on us and tell us to ignore parts of it. We're offering our time and experience without charging you, the least you can do is take the time to eliminate the irrelevant parts of the code yourself, and show us the smallest piece of code which demonstrates the problem. " i appr

Re: files,folders,paths

2011-02-13 Thread ecu_jon
On Feb 13, 8:17 am, Dave Angel wrote: > On 01/-10/-28163 02:59 PM, ecu_jon wrote: > > > > > i just tried changing that in ver12a, still get > > IOError: [Errno 2] No such file or directory: 'V:\\week2\\configs\ > > \apache2.conf' > > good catch th

Re: files,folders,paths

2011-02-13 Thread ecu_jon
i just tried changing that in ver12a, still get IOError: [Errno 2] No such file or directory: 'V:\\week2\\configs\ \apache2.conf' good catch tho as that is needed. thanks. weekchoice is used to pick week 1-4. really jsut returns 1-4. i plan to do full weekly backups with another script. getusername

files,folders,paths

2011-02-13 Thread ecu_jon
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, th

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

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 mani

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,

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 > >      homed

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 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 a

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