New submission from S Arrowsmith:
Compare this with the script in #14252:
p = Popen(['/bin/sleep', '1'])
time.sleep(1)
p.terminate()
print p.poll()
p.terminate()
Output is:
0
Traceback (most recent call last):
File "", line 1, in
File "/usr/lib/pyth
S Arrowsmith added the comment:
That solution looks sound to me, in particular documenting the semantics of
repeated init() calls!
As for the underlying problem, it seems to me that an alternative to copying
the existing structures rather than rebuilding them would be to use
OrderedDicts
S Arrowsmith added the comment:
I've dug into it -- again -- and my original analysis still holds. Getting
consistent guess_extension() results across an explicit init() call depends on
dict.items() returning keys in the same order on two different dictionaries
(the original, hard-
S Arrowsmith added the comment:
>>> import mimetypes
>>> mimetypes.guess_extension('image/jpeg')
/etc/mime.types
'.jpe'
>>> mimetypes.init()
/etc/mime.types
>>> mimetypes.guess_extension('imag
S Arrowsmith added the comment:
Sorry, still there:
Python 2.7rc2 (r27rc2:82137, Jun 26 2010, 11:27:59)
[GCC 4.3.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import mimetypes
>>> mimetyp
Changes by S Arrowsmith :
--
nosy: +siona
___
Python tracker
<http://bugs.python.org/issue6925>
___
___
Python-bugs-list mailing list
Unsubscribe:
S Arrowsmith added the comment:
Ah, yes, forgot to mention this is on Debian 4.0. I doubt you're going
to run into it on a Windows system unless you explicitly give init() a
mime.types file, looking at the knownfiles list used by default.
___
Python tr
New submission from S Arrowsmith :
Asking mimetypes to reload mime.types can cause guess_extension() to
return a different result if multiple extensions are mapped to that mime
type:
>>> import mimetypes
>>> mimetypes.guess_extension('image/jpeg'