Issue 1115886: os.path.splitext don't handle unix hidden file correctly (original) (raw)

Created on 2005-02-04 01:27 by falsetru, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Messages (8)
msg24149 - (view) Author: Jeong-Min Lee (falsetru) Date: 2005-02-04 01:27
I expected this. >>> os.path.splitext('/path/to/.Hiddenfile') ('/path/to/.Hiddenfile', '') but got this. >>> os.path.splitext('/path/to/.Hiddenfile') ('/path/to/', '.Hiddenfile')
msg24150 - (view) Author: engelbert gruber (grubert) * Date: 2005-06-13 14:12
Logged In: YES user_id=147070 from test_posixpath.py :: self.assertEqual(posixpath.splitext(".ext"), ("", ".ext")) IMHO should then return (".ext",""). if this is desired :: if i<=p.rfind('/'): return p, '' else: return p[:i], p[i:] should do
msg24151 - (view) Author: Georg Brandl (georg.brandl) * (Python committer) Date: 2005-06-18 21:05
Logged In: YES user_id=1188172 Interestingly, altering the behaviour of splitext in such a way does not contradict the documentation, which is: """ Split the pathname path into a pair (root, ext) such that root + ext == path, and ext is empty or begins with a period and contains at most one period. """ Personally I'm in favour of this change (on Unix it makes sense, while on Windows you can hardly find an "extension-only" file).
msg24152 - (view) Author: John J Lee (jjlee) Date: 2005-12-04 14:44
Logged In: YES user_id=261020 -1 I hate to be a stick-in-the-mud, but the existing behaviour is what I would expect, and seems to be regular -- always picks the last dot: >>> os.path.splitext('a/b/c/foo.bar') ('a/b/c/foo', '.bar') >>> os.path.splitext('a/b/c/f.oo.bar') ('a/b/c/f.oo', '.bar') >>> os.path.splitext('a/b/c/.foo') ('a/b/c/', '.foo') >>> os.path.splitext('a/b/c/.foo.txt') ('a/b/c/.foo', '.txt') Changing it would surely break somebody's code too, of course.
msg24153 - (view) Author: Jim Jewett (jimjjewett) Date: 2007-03-06 23:20
1462106 is a patch, though perhaps not the latest. python-dev is currently debating whether to fix this behavior or maintain backwards-compatibility. That suggests that it at least won't be changed in a bugfix version (like 2.4.x), and the group should be changed to 2.6.
msg24154 - (view) Author: Martin v. Löwis (loewis) * (Python committer) Date: 2007-03-07 11:05
After some discussion on python-dev, I fixed this in r54204.
msg92270 - (view) Author: Alexandru Munteanu (optimix) Date: 2009-09-04 22:16
I've read parts of the python-dev discussions, but I don't agree with this change: mimetypes.guess_type() now recognises '.ogg' as None.
msg92638 - (view) Author: Senthil Kumaran (orsenthil) * (Python committer) Date: 2009-09-15 00:01
Alexandru: You commented on a closed issue. If you see any problem with mimetypes.guess_type() w.r.t to .ogg files, please open a new open stating your problem.
History
Date User Action Args
2022-04-11 14:56:09 admin set github: 41522
2009-09-15 00:01:44 orsenthil set nosy: + orsenthilmessages: +
2009-09-04 22:16:05 optimix set nosy: + optimixmessages: +
2005-02-04 01:27:06 falsetru create