Terry J. Reedy added the comment:

According to the tcl/tk manual, tcl does ~ expansion on non-'old' Windows.  
However, I cannot tell in what context that could be useful.  Trying to save to 
'~/x.py' fails. "The filename is not valid."  This might be because there is no 
HOME since Windows sometimes uses USERPROFILE instead.  But it seems that any 
name with a path separator is invalid.  At least on Windows, one must specify 
the directory my moving to it in the directory part of the dialog.

If dirname (passed to tk_getSaveFile as initialdir) is not "" after the split 
of self.filename (and I believe it never is), it seems to me possibly a bug 
that tk_getSaveFile looks for a leading ~ for base (passed as initialfile).  
But we cannot affect that.  Serhiy, your suggesting to check self.filename 
(full name) instead of base would be correct if tk did not check base after it 
is split off.  But it does, buggy or not.  The full name of the project file 
that failed was something like F:/python/~templete.py.

Martin and Serhiy.  If I understand correctly, you are both suggesting that 
'~x.py' should become './~x.py' instead of '\~x.py'.  This seems to work 
equally well.  It seems that after ~ processing, the basename gets changed back 
to and displayed as '~x.py' and saving as such works.

You also suggest that at least your version of the escaping should not be 
limited to Windows.  It seems like this might help, and should not hurt, but I 
would like the latter tested on Linux before I commit.  Attached is my patch 
with both changes.

----------
stage: needs patch -> patch review
Added file: http://bugs.python.org/file36887/@tilde.patch

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue15363>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to