List Info

Thread: Suggested change to document.py




Suggested change to document.py
user name
2006-11-02 21:31:50
The problem is much more involved to describe than the
solution.  I run 
windows XP, and I keep
python scripts all over my drive.  Rather than adding all
sorts of 
subdirectory's to my path, i create
hardlinks to the scripts that I need to use from the command
line in a 
single bin directory.  The
problem is that when I edit a file with PythonWin, the code
to save the 
file first
renames the current version of the file to a backup version,
and then 
saves new file with same
name.  This is a problem, because the hardlink now connects
the backup 
copy to the copy living in my
bin directory, so when I try to run it, the backup runs
instead of the 
current version.

The solution seems to be change
pythonwinpywinframeworkeditordocument.py line 70
from: os.rename(fileName, bakFileName)
to: something like shutil.copy(fileName, bakFileName)
and adding "import shutil" at the top

This seems to work for me.  That said, I do not have CVS,
and I am 
unwilling to invest the time
and effort to install it to make this change.  If this email
is 
worthless, since I am too lazy to install
cvs and make the change myself, then please feel free to
ignore me.

Have a good one everybody,
Gerard
_______________________________________________
Python-win32 mailing list
Python-win32python.org

http://mail.python.org/mailman/listinfo/python-win32
Suggested change to document.py
user name
2006-11-02 21:52:19
Gerard Brunick wrote:
> ...I run windows XP, and I keep
> python scripts all over my drive.  Rather than adding
all sorts of 
> subdirectory's to my path, i create
> hardlinks to the scripts that I need to use from the
command line in a 
> single bin directory.
> ...
> The solution seems to be change
> pythonwinpywinframeworkeditordocument.py line 70
> from: os.rename(fileName, bakFileName)
> to: something like shutil.copy(fileName, bakFileName)
> and adding "import shutil" at the top
>
> This seems to work for me.

Very interesting.  This is a problem that Unix folks have
faced since
time immemorial, but virtually no one uses hard links in
Windows.

The advantage of the os.rename method is performance, but
since Python
scripts are always too small to worry about, I'd be in favor
of this
change, assuming we used shutil.copy2 to retain the dates
and times.

-- 
Tim Roberts, timrprobo.com
Providenza & Boekelheide, Inc.

_______________________________________________
Python-win32 mailing list
Python-win32python.org

http://mail.python.org/mailman/listinfo/python-win32
Suggested change to document.py
user name
2006-11-02 22:21:16
At Thursday 2/11/2006 18:52, Gerard Brunick wrote:

> > ...I run windows XP, and I keep
> > python scripts all over my drive.  Rather than
adding all sorts of
> > subdirectory's to my path, i create
> > hardlinks to the scripts that I need to use from
the command line in a
> > single bin directory.

I don't even knew hard links existed on Windows! Thanks...


-- 
Gabriel Genellina
Softlab SRL 

__________________________________________________
Correo Yahoo!
Espacio para todos tus mensajes, antivirus y antispam
ˇgratis! 
ˇAbrí tu cuenta ya! - http://correo.yahoo.com.ar

_______________________________________________
Python-win32 mailing list
Python-win32python.org

http://mail.python.org/mailman/listinfo/python-win32
[1-3]

about | contact  Other archives ( Real Estate discussion Medical topics )