New submission from Dave Abrahams <dave(a)boostpro.com>:
On POSIX systems, the PATH environment variable is always used to
look up directory-less executable names passed as the first argument to Popen(...), but on Windows, PATH is only considered when shell=True is also passed.
Actually I think it may be slightly weirder than that when
shell=False, because the following holds for me:
C:\>rem ##### Prepare minimal PATH #####
C:\>set "PATH=C:\Python26\Scripts;C:\Python26;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem"
C:\>rem ##### Prepare a minimal, clean environment #####
C:\>virtualenv --no-site-packages e:\zzz
New python executable in e:\zzz\Scripts\python.exe
Installing setuptools................done.
C:\>rem ##### Show that shell=True makes the difference in determining whether PATH is respected #####
C:\>python
Python 2.6.5 (r265:79096, Mar 19 2010, 18:02:59) [MSC v.1500 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import subprocess
>>> subprocess.Popen(['python', '-c', 'import sys; print sys.executable'])
<subprocess.Popen object at 0x0000000001DBE080>
>>> C:\Python26\python.exe
>>> subprocess.Popen(['python', '-c', 'import sys; print sys.executable'], env={'PATH':r'e:\zzz\Scripts'})
<subprocess.Popen object at 0x0000000001F05A90>
>>> C:\Python26\python.exe
>>> subprocess.Popen(['python', '-c', 'import sys; print sys.executable'], env={'PATH':r'e:\zzz\Scripts'}, shell=True)
<subprocess.Popen object at 0x0000000001F05B00>
>>> e:\zzz\Scripts\python.exe
That is, it looks like the environment at the time Python is invoked is what counts unless I pass shell=True. I don't even seem to be able to override this behavior by changing os.environ: you can clear() it and pass env={} and subprocess.Popen(['python']) still succeeds.
This is a very important problem for portable code and one that took me hours to suss out. I think:
a) the current behavior needs to be documented
b) it needs to be fixed if possible
c) otherwise, shell=True should be the default
----------
assignee: docs@python
components: Documentation
messages: 104422
nosy: dabrahams, docs@python
priority: normal
severity: normal
status: open
title: subprocess portability issue
type: behavior
versions: Python 2.6
_______________________________________
Python tracker <report(a)bugs.python.org>
<http://bugs.python.org/issue8557>
_______________________________________
New submission from Jeff McNeil <jeff(a)jmcneil.net>:
I was going through the string formatting examples this evening and noticed this:
print '%(language)s has %(#)03d quote types.' % \
{'language': "Python", "#": 2}
The example uses a '#' as a map key. This is somewhat misleading as if we had simply left the parenthesis off, the '#' would have been interpreted as an alternate conversion flag. Should be updated to use a more verbose (and less confusing) dictionary key.
----------
assignee: docs@python
components: Documentation
files: stdtypes.rst.2.6.5.patch
keywords: patch
messages: 104410
nosy: docs@python, mcjeff
priority: normal
severity: normal
status: open
title: Confusing string formatting examples
versions: Python 2.6
Added file: http://bugs.python.org/file17115/stdtypes.rst.2.6.5.patch
_______________________________________
Python tracker <report(a)bugs.python.org>
<http://bugs.python.org/issue8556>
_______________________________________
New submission from AdamN <adam(a)varud.com>:
This bug from the Ubuntu list is being moved here:
https://bugs.launchpad.net/ubuntu/+source/python-defaults/+bug/570737
Newlines support is enabled on Ubuntu but the example from:
http://www.python.org/dev/peps/pep-0278/
Does not give the correct results (of True):
if hasattr(open, 'newlines'):
print 'We have universal newline support'
I don't know if this is a documentation problem or whether there is another attr that matters here.
----------
assignee: docs@python
components: Documentation, Windows
messages: 104454
nosy: adamnelson, docs@python
priority: normal
severity: normal
status: open
title: hasattr(open,'newlines') example gives incorrect results from PEP0278
type: behavior
versions: Python 2.6
_______________________________________
Python tracker <report(a)bugs.python.org>
<http://bugs.python.org/issue8562>
_______________________________________
New submission from Peter Fein <pfein(a)pobox.com>:
The documentation on integrating doctests in a file of unittests is confusing and out of date. This patch updates the documentation to use unittest2 test discovery.
----------
assignee: docs@python
components: Documentation
files: doctest_unittest_integration_doc.diff
keywords: patch
messages: 104468
nosy: docs@python, pfein
priority: normal
severity: normal
status: open
title: Update documentation on doctest/unittest2 integration
versions: Python 2.7, Python 3.3
Added file: http://bugs.python.org/file17123/doctest_unittest_integration_doc.diff
_______________________________________
Python tracker <report(a)bugs.python.org>
<http://bugs.python.org/issue8564>
_______________________________________
in ftplib docs, http://docs.python.org/library/ftplib.html?highlight=ftplib#module-ftplib,
description of
ftplib.all_errors
3rd line:
"errors made by the caller). This set includes the four exceptions listed below as"
It should be:
"errors made by the caller). This set includes the four exceptions listed above as"
New submission from Giampaolo Rodola' <g.rodola(a)gmail.com>:
I recently took a look at asynchat doc and found out it has some issues which should be addressed.
In my opinion the following methods and functions should NOT be mentioned:
- async_chat.refill_buffer()
this has been removed in Python 2.6 and no longer exists, plus there was no reason to override it in the first place as it was an internal method
- asynchat.find_prefix_at_end(haystack, needle)
there's really no reason to mention this one, it is just used internally by async_chat class to implement the terminator logic
- async_chat.handle_close()
- async_chat.readable()
- async_chat.writable()
- async_chat.handle_read()
- async_chat.handle_write()
all inherited from asyncore, plus, aside from handle_close(), they should *NOT* be overridden as they implement the entire logic behind asynchat module
- class asynchat.simple_producer(data[, buffer_size=512])
- class asynchat.fifo([list=None])
as discussed in issue 6916 these are very old classes which are no longer used; imho not worth to be mentioned in the doc
- async_chat._collect_incoming_data(data)
- async_chat._get_data()
both added in 2.6 (this isn't mentioned), not sure if it's worth mentioning them (I wouldn't) but they're basically private methods which are never used in the base class and only provide a sample implementation
I think asynchat documentation should focus more on showing those parts of the API which are really going to be used, basically push*(), close_when_done() and terminator-related methods.
All other methods like handle_*(), etc..., are deliberately not supposed to be used and only create confusion.
I think I'm going to attach a patch tomorrow but I'd like to hear the opinion of Josiah Carlson before doing anything.
----------
assignee: docs@python
components: Documentation
messages: 104292
nosy: docs@python, giampaolo.rodola, josiah.carlson, josiahcarlson, r.david.murray
priority: normal
severity: normal
status: open
title: asynchat documentation issues
versions: Python 2.6, Python 2.7, Python 3.1, Python 3.2
_______________________________________
Python tracker <report(a)bugs.python.org>
<http://bugs.python.org/issue8543>
_______________________________________
Just spotted this in the docs for 2.7:
""" Deprecated since version 2.7: failUnless(); use one of the assert
variants. assert_(); use assertTrue()."""
Cheers,
Nick.
--
Nick Coghlan | ncoghlan(a)gmail.com | Brisbane, Australia
---------------------------------------------------------------
Hi.
in this document,
http://docs.python.org/py3k/tutorial/datastructures.html
>>> basket = {'apple', 'orange', 'apple', 'pear', 'orange', 'banana'}>>> print(basket){'orange', 'banana', 'pear', 'apple'}>>> fruit = ['apple', 'orange', 'apple', 'pear', 'orange', 'banana']>>> fruit = set(basket) # create a set without duplicates
the last sentence should be like below one. basket was originally set,
so we don't need to change to set redundantly I think.
*
>>> fruit = set(fruit) # create a set without duplicates
*
Antoine Pitrou <pitrou(a)free.fr> added the comment:
I've updated the doc in r80591. Sorry for the inconvenience!
----------
resolution: -> invalid
status: open -> closed
_______________________________________
Python tracker <report(a)bugs.python.org>
<http://bugs.python.org/issue8558>
_______________________________________
Hi
disable_existing_loggers should be described also for py versions < 3k
fileConfig(fname, defaults=None, disable_existing_loggers=1)
from the http://docs.python.org/py3k/library/logging.html
If disable_existing_loggers is true, any existing loggers that are not
children of named loggers will be disabled.
cheers
Reimar