This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author terry.reedy
Recipients loewis, roger.serwy, serhiy.storchaka, terry.reedy
Date 2014-10-12.08:54:17
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1413104058.14.0.0587996491083.issue15363@psf.upfronthosting.co.za>
In-reply-to
Content
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.
History
Date User Action Args
2014-10-12 08:54:18terry.reedysetrecipients: + terry.reedy, loewis, roger.serwy, serhiy.storchaka
2014-10-12 08:54:18terry.reedysetmessageid: <1413104058.14.0.0587996491083.issue15363@psf.upfronthosting.co.za>
2014-10-12 08:54:18terry.reedylinkissue15363 messages
2014-10-12 08:54:17terry.reedycreate