path to executing .py file
MRAB
google at mrabarnett.plus.com
Tue Apr 14 08:38:44 EDT 2009
tiefeng wu wrote:
> Hello everybody!
>
> I'm working on my code repository (svn) auto-backup script which get
> hotcopy of svn repository
> directory to a directory named by date in same location where script
> file is, it executed by a timer
> program every 00:00 clock. Everything works fine when I'm testing by
> double click it. But when
> auto execute it, I got unexpected behavior. The backup directory will be
> created under
> "C:\Documents and settings\username". I create backup directory by this way:
>
> os.mkdir(os.getcwd() + arch_dir)
>
> is there some way to get path to my executing script, so I can replaced
> "os.getcwd()" in above
> line?
>
The path of your script is given by __file__.
> And I have another question, I've tried remove a copy of svn repository
> by calling
>
> shutil.rmtree(svn_repos_copy_dir)
>
> I got error "Access denied!" Is that mean my script has no power to
> delete it? Is there some way to
> give the right to do that?
>
More information about the Python-list
mailing list