pylib-1.4.1: bug fixes

2011-02-07 Thread holger krekel
py-1.4.1: cross-python lib for fs path, code, io, ... manipulations
===

This is a bug fix release of the py lib, see below for detailed changes.

The py lib is a small library comprising APIs for filesystem and svn path
manipulations, dynamic code construction and introspection, a Py2/Py3
compatibility namespace (py.builtin), IO capturing, terminal colored printing
(on windows and linux), ini-file parsing and a lazy import mechanism.
It runs unmodified on all Python interpreters compatible to Python2.4 up
until Python 3.2, PyPy and Jython.  The general goal with py is to
provide stable APIs for some common tasks that are continously tested
against many Python interpreters and thus also to help transition. Here
are some docs:

http://pylib.org

NOTE: The prior py-1.3.X versions contained py.test which since py-1.4.0
comes as its own separate pytest distribution, see:

http://pytest.org
   
Also, the py.cleanup|py.lookup|py.countloc helpers are now part of
the pycmd distribution, see http://pypi.python.org/pypi/pycmd


Changes between 1.4.0 and 1.4.1
==

- fix issue1 - py.error.* classes to be pickleable

- fix issue2 - on windows32 use PATHEXT as the list of potential
  extensions to find find binaries with py.path.local.sysfind(commandname)

- fix (pytest-) issue10 and refine assertion reinterpretation
  to avoid breaking if the __nonzero__ of an object fails

- fix (pytest-) issue17 where python3 does not like star-imports,
  leading to misrepresentation of import-errors in test modules

- fix ``py.error.*`` attribute pypy access

- allow path.samefile(arg) to succeed when arg is a relative filename

- fix (pytest-) issue20 path.samefile(relpath) works as expected now
-- 
http://mail.python.org/mailman/listinfo/python-announce-list

Support the Python Software Foundation:
http://www.python.org/psf/donations/


pytest-2.0.1: bug fixes and better asserts

2011-02-07 Thread holger krekel
py.test 2.0.1: bug fixes and better asserts
===

Welcome to pytest-2.0.1, a maintenance and bug fix release of pytest,
a mature testing tool for Python, supporting CPython 2.4-3.2, Jython 
and latest PyPy interpreters.  See extensive docs with tested examples here:

http://pytest.org/

If you want to install or upgrade pytest, just type one of::

pip install -U pytest # or
easy_install -U pytest

Many thanks to all issue reporters and people asking questions or
complaining.  Particular thanks to Floris Bruynooghe and Ronny Pfannschmidt
for their great coding contributions and many others for feedback and help.

best,
holger krekel


Changes between 2.0.0 and 2.0.1
--

- refine and unify initial capturing so that it works nicely
  even if the logging module is used on an early-loaded conftest.py
  file or plugin.
- fix issue12 - show plugin versions with --version and
  --traceconfig and also document how to add extra information
  to reporting test header
- fix issue17 (import-* reporting issue on python3) by
  requiring py1.4.0 (1.4.1 is going to include it)
- fix issue10 (numpy arrays truth checking) by refining
  assertion interpretation in py lib
- fix issue15: make nose compatibility tests compatible
  with python3 (now that nose-1.0 supports python3)
- remove somewhat surprising same-conftest detection because
  it ignores conftest.py when they appear in several subdirs.
- improve assertions (not in), thanks Floris Bruynooghe
- improve behaviour/warnings when running on top of python -OO
  (assertions and docstrings are turned off, leading to potential
  false positives)
- introduce a pytest_cmdline_processargs(args) hook
  to allow dynamic computation of command line arguments.
  This fixes a regression because py.test prior to 2.0
  allowed to set command line options from conftest.py
  files which so far pytest-2.0 only allowed from ini-files now.
- fix issue7: assert failures in doctest modules.
  unexpected failures in doctests will not generally
  show nicer, i.e. within the doctest failing context.
- fix issue9: setup/teardown functions for an xfail-marked
  test will report as xfail if they fail but report as normally
  passing (not xpassing) if they succeed.  This only is true
  for direct setup/teardown invocations because teardown_class/
  teardown_module cannot closely relate to a single test.
- fix issue14: no logging errors at process exit
- refinements to collecting output on non-ttys
- refine internal plugin registration and --traceconfig output
- introduce a mechanism to prevent/unregister plugins from the
  command line, see http://pytest.org/plugins.html#cmdunregister
- activate resultlog plugin by default
- fix regression wrt yielded tests which due to the
  collection-before-running semantics were not
  setup as with pytest 1.3.4.  Note, however, that
  the recommended and much cleaner way to do test
  parametraization remains the pytest_generate_tests
  mechanism, see the docs.
-- 
http://mail.python.org/mailman/listinfo/python-announce-list

Support the Python Software Foundation:
http://www.python.org/psf/donations/


ANN: 8-Day Python Power Course in Leipzig/Germany

2011-02-07 Thread Mike Müller

Eight Days of Python Training
-

Can't get enough of Python? Then this course is for you.
A three day introduction to Python as a warm-up, followed by five
days of advanced Python training. All courses given in English.

May 13 - 15, 2011  Python for Programmers
May 16 - 20, 2011  Python Power Course
   May 16, 2011   Advanced Python Programming
   May 17, 2011   Optimizing Python Programs
   May 18, 2011   Python Extensions with Other Languages
   May 19, 2011   Fast Code with the Cython Compiler
   May 20, 2011   High Performance XML with Python

Venue: Python Academy, Leipzig, Germany
Trainers: Mike Müller, Stefan Behnel

About the Trainers
--

Mike Müller, Ph.D has been teaching Python since 2004. He is the
founder of Python Academy and regularly gives open and in-house
Python courses as well as tutorials at PyCon US, OSCON, EuroSciPy
and PyCon Asia-Pacific.

Stefan Behnel, Ph.D is Senior Software Developer at Senacor Technologies AG
as well as freelance consultant and software developer specializing
in Python and Open Source. He is core developer of both the Cython compiler
and the lxml XML toolkit.

More Information


http://www.python-academy.com/courses/python_power_course.html

--
Mike
mmuel...@python-academy.de
--
http://mail.python.org/mailman/listinfo/python-announce-list

   Support the Python Software Foundation:
   http://www.python.org/psf/donations/


Re: Are Small Dogs Good with Kids?

2011-02-07 Thread Stefan Behnel

Bob Martin, 07.02.2011 08:19:

My two terriers absolutely love children.


H, tasty ...

Stefan

--
http://mail.python.org/mailman/listinfo/python-list


Re: Are Small Dogs Good with Kids?

2011-02-07 Thread Littlefield, Tyler
Not only does this have -nothing- to do with python, but you reproduced 
the spam yet again by quoting it... seriously?

--
http://mail.python.org/mailman/listinfo/python-list


Turbogears 2.1 with mako tmplates

2011-02-07 Thread Vineet Deodhar
Hi!,
I am a python programmer.
For web-based solutions, I have started learning TG 2.1
By and large, the documentation on TG 2.1 official site is a work-in-process.
As regards to the templates, it tells how to go about Genshi.
I wish to go with mako.
Gone through the docs of mako (they are good).
But still, it would be better if I can get a tutorial explaining using TG 2.1 
with mako.
(It will save me from re-inventing the wheel, if somebody has written docs on 
these lines).
Can anybody point to any such tutorial?
(I googled, but couldn't locate any convincing result).

Thanks,
Vineet


  -- 
http://mail.python.org/mailman/listinfo/python-list


re.Scanner - match python dot notation

2011-02-07 Thread Christian K.

Hi,

I am trying to find a regexp to be used with re.Scanner that matches the 
'package.module.member' syntax. More specifically I want to parse 
function strings like


numpy.sin(x*a+w)

and sort out variables/constants.

This one here works using re.match but fails when used with Scanner (due 
to the grouping () I guess).


r'((?=.*[a-zA-Z])(?=.+[\.]).+)[\(\+\-]+'

I highly appreciate your comments.

Regards, christian

--
http://mail.python.org/mailman/listinfo/python-list


Re: returning all matching groups with re.search()

2011-02-07 Thread Mauro Caceres
 import re
 help(re.findall)
Help on function findall in module re:

findall(pattern, string, flags=0)
Return a list of all non-overlapping matches in the string.

If one or more groups are present in the pattern, return a
list of groups; this will be a list of tuples if the pattern
has more than one group.

Empty matches are included in the result.

 re.findall('e','fredbarneybettywilma')
['e', 'e', 'e']

-- 
Mauro Cáceres
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: re.Scanner - match python dot notation

2011-02-07 Thread MRAB

On 07/02/2011 15:34, Christian K. wrote:

Hi,

I am trying to find a regexp to be used with re.Scanner that matches the
'package.module.member' syntax. More specifically I want to parse
function strings like

numpy.sin(x*a+w)

and sort out variables/constants.

This one here works using re.match but fails when used with Scanner (due
to the grouping () I guess).

r'((?=.*[a-zA-Z])(?=.+[\.]).+)[\(\+\-]+'

I highly appreciate your comments.

Regards, christian


I'm not sure about your regex, but I'd probably use this:

r'[A-Za-z_][A-Za-z0-9_]*(?:\.[A-Za-z_][A-Za-z0-9_]*)*'
--
http://mail.python.org/mailman/listinfo/python-list


Re: itertools.groupby usage to get structured data

2011-02-07 Thread nn
On Feb 5, 7:12 am, Peter Otten __pete...@web.de wrote:
 Slafs wrote:
  Hi there!

  I'm having trouble to wrap my brain around this kind of problem:

  What I have :
    1) list of dicts
    2) list of keys that i would like to be my grouping arguments of
  elements from 1)
    3) list of keys that i would like do aggregation on the elements
  of 1) with some function e.g. sum

  For instance i got:
  1) [ { 'g1' : 1, 'g2' : 8, 's_v1' : 5.0, 's_v2' : 3.5 },
        { 'g1' : 1, 'g2' : 9, 's_v1' : 2.0, 's_v2' : 3.0 },
        {'g1' : 2, 'g2' : 8, 's_v1' : 6.0, 's_v2' : 8.0}, ... ]
  2) ['g1', 'g2']
  3) ['s_v1', 's_v2']

  To be precise 1) is a result of a values_list method from a QuerySet
  in Django; 2) is the arguments for that method; 3) those are the
  annotation keys. so 1) is a result of:
     qs.values_list('g1', 'g2').annotate(s_v1=Sum('v1'), s_v2=Sum('v2'))

  What i want to have is:
  a big nested dictionary with 'g1' values as 1st level keys and a
  dictionary of aggregates and subgroups in it.

  In my example it would be something like this:
  {
    1 : {
            's_v1' : 7.0,
            's_v2' : 6.5,
            'g2' :{
                     8 : {
                            's_v1' : 5.0,
                            's_v2' : 3.5 },
                     9 :  {
                            's_v1' : 2.0,
                            's_v2' : 3.0 }
                  }
         },
    2 : {
             's_v1' : 6.0,
             's_v2' : 8.0,
             'g2' : {
                      8 : {
                            's_v1' : 6.0,
                            's_v2' : 8.0}
             }
         },
  ...
  }

  # notice the summed values of s_v1 and s_v2 when g1 == 1

  I was looking for a solution that would let me do that kind of
  grouping with variable lists of 2) and 3) i.e. having also 'g3' as
  grouping element so the 'g2' dicts could also have their own
  subgroup and be even more nested then.
  I was trying something with itertools.groupby and updating nested
  dicts, but as i was writing the code it started to feel too verbose to
  me :/

  Do You have any hints maybe? because i'm kind of stucked :/

  Regards

  Sławek

 Not super-efficient, but simple:

 $ cat python sumover.py
 cat: python: No such file or directory
 data = [ { 'g1' : 1, 'g2' : 8, 's_v1' : 5.0, 's_v2' : 3.5 },
          { 'g1' : 1, 'g2' : 9, 's_v1' : 2.0, 's_v2' : 3.0 },
          {'g1' : 2, 'g2' : 8, 's_v1' : 6.0, 's_v2' : 8.0}]
 sum_over = [s_v1, s_v2]
 group_by = [g1, g2]

 wanted = {
   1 : {
           's_v1' : 7.0,
           's_v2' : 6.5,
           'g2' :{
                    8 : {
                           's_v1' : 5.0,
                           's_v2' : 3.5 },
                    9 :  {
                           's_v1' : 2.0,
                           's_v2' : 3.0 }
                 }
        },
   2 : {
            's_v1' : 6.0,
            's_v2' : 8.0,
            'g2' : {
                     8 : {
                           's_v1' : 6.0,
                           's_v2' : 8.0}
            }
        },

 }

 def calc(data, group_by, sum_over):
     tree = {}
     group_by = group_by + [None]
     for item in data:
         d = tree
         for g in group_by:
             for so in sum_over:
                 d[so] = d.get(so, 0.0) + item[so]
             if g:
                 d = d.setdefault(g, {}).setdefault(item[g], {})
     return tree

 got = calc(data, group_by, sum_over)[group_by[0]]
 assert got == wanted
 $ python sumover.py
 $

 Untested.

Very clever. I didn't understand how it worked until I rewrote it like
this:

def calc(data, group_by, sum_over):
tree = {}
group_by = [None] + group_by
for item in data:
d = tree
for g in group_by:
if g:
d = d.setdefault(g, {}).setdefault(item[g], {})
for so in sum_over:
d[so] = d.get(so, 0.0) + item[so]
return tree


Processing None in the last round of the loop was throwing me off.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: re.Scanner - match python dot notation

2011-02-07 Thread Peter Otten
Christian K. wrote:

 I am trying to find a regexp to be used with re.Scanner that matches the
 'package.module.member' syntax. More specifically I want to parse
 function strings like
 
 numpy.sin(x*a+w)
 
 and sort out variables/constants.

No direct answer, but regarding your ultimate goal the ast module might be a 
better starting point.
-- 
http://mail.python.org/mailman/listinfo/python-list


splitting by double newline

2011-02-07 Thread Nikola Skoric
Hello everybody,

I'd like to split a file by double newlines, but portably. Now,
splitting by one or more newlines is relatively easy:

self.tables = re.split([\r\n]+, bulk)

But, how can I split on double newlines? I tried several approaches,
but none worked...

-- 
Now the storm has passed over me
I'm left to drift on a dead calm sea
And watch her forever through the cracks in the beams
Nailed across the doorways of the bedrooms of my dreams
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: splitting by double newline

2011-02-07 Thread Ian
On Feb 7, 10:43 am, Nikola Skoric n...@fly.srk.fer.hr wrote:
 Hello everybody,

 I'd like to split a file by double newlines, but portably. Now,
 splitting by one or more newlines is relatively easy:

 self.tables = re.split([\r\n]+, bulk)

 But, how can I split on double newlines? I tried several approaches,
 but none worked...

self.tables = re.split(r'(?:\r\n){2,}|\r{2,}|\n{2,}', bulk)
-- 
http://mail.python.org/mailman/listinfo/python-list


Remove whitespaces and line breaks in a XML file

2011-02-07 Thread David Vicente
Hi,

 

I´m parsing an xml file with xml.etree. It works correctly, but I have a
problem with the text attribute of the elements which should be empty. For
example, in this case:

book

authorKenauthor

/book

 

The text element of “book” should be empty, but it returns me some
whitespaces and break lines. I can´t get remove these whitespaces without
remove information. 

 

Some idea?

 

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: splitting by double newline

2011-02-07 Thread Peter Otten
Nikola Skoric wrote:

 Hello everybody,
 
 I'd like to split a file by double newlines, but portably. Now,
 splitting by one or more newlines is relatively easy:
 
 self.tables = re.split([\r\n]+, bulk)
 
 But, how can I split on double newlines? I tried several approaches,
 but none worked...

If you open the file in universal newline mode with

with open(filename, U) as f:
bulk = f.read()

your data will only contain \n. You can then split with 

blocks = bulk.split(\n\n) # exactly one empty line

or 

blocks = re.compile(r\n{2,}).split(bulk) # one or more empty lines

One last variant that doesn't read in the whole file and accepts lines with 
only whitespace as empty:

with open(filename, U) as f:
blocks = (.join(group) for empty, group in itertools.groupby(f, 
key=str.isspace) if not empty)
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: re.Scanner - match python dot notation

2011-02-07 Thread Christian K.

Am 07.02.11 17:47, schrieb MRAB:

On 07/02/2011 15:34, Christian K. wrote:

Hi,

I am trying to find a regexp to be used with re.Scanner that matches the
'package.module.member' syntax. More specifically I want to parse
function strings like

numpy.sin(x*a+w)

and sort out variables/constants.

This one here works using re.match but fails when used with Scanner (due
to the grouping () I guess).

r'((?=.*[a-zA-Z])(?=.+[\.]).+)[\(\+\-]+'

I highly appreciate your comments.

Regards, christian


I'm not sure about your regex, but I'd probably use this:

r'[A-Za-z_][A-Za-z0-9_]*(?:\.[A-Za-z_][A-Za-z0-9_]*)*'


Perfect, thanks. I changed the last * to a + so that the string must 
contain a '.' to match.


Christian

--
http://mail.python.org/mailman/listinfo/python-list


Re: Turbogears 2.1 with mako tmplates

2011-02-07 Thread Alice Bevan–McGregor

On 2011-02-07 07:13:43 -0800, Vineet Deodhar said:


For web-based solutions, I have started learning TG 2.1
By and large, the documentation on TG 2.1 official site is a work-in-process.
As regards to the templates, it tells how to go about Genshi.
I wish to go with mako.
Gone through the docs of mako (they are good).
But still, it would be better if I can get a tutorial explaining using 
TG 2.1 with mako.
(It will save me from re-inventing the wheel, if somebody has written 
docs on these lines).

Can anybody point to any such tutorial?
(I googled, but couldn't locate any convincing result).


I believe you will have signifigantly greater success having TurboGears 
questions answered when asked on the appropriate forum:


http://groups.google.com/group/turbogears

— Alice.


--
http://mail.python.org/mailman/listinfo/python-list


Universal Feed Browser problem in feedparser.py

2011-02-07 Thread Virgil Stokes
I am running Python 2.6 on a Windows Vista (32-bit) platform. I recently 
installed the Universal Feed Parser package (feedparser-5-0). When I try to 
execute the following commands:


 import feedparser
 d = feedparser.parse(http://feedparser.org/docs/examples/atom10.xml;)

which is given at http://www.feedparser.org/

I get an Assertion error in the following function in feedparser.py


def __getattr__(self, key):
try:
  return self.__dict__[key]
except KeyError:
  pass
try:
  assert not key.startswith('_') ---  Error occurs when this 
statement is executed.

  return self.__getitem__(key)
except:
  raise AttributeError, object has no attribute '%s' % key


Why does the error occur and how should he be corrected?

--
http://mail.python.org/mailman/listinfo/python-list


Re: Fully functioning email client in Python

2011-02-07 Thread John Nagle

On 2/5/2011 5:34 PM, iaoua iaoua wrote:


What I really need is a ready made fully functional Python client that
already has it that offers me a simple interface to extract text from
received messages along with a message id that I can use to associate
the response to a question with and allows me to send out new
questions or answers along with a message id I can use to track future
responses with. I need something that already has the whole shebang.
Can support POP3, IMAP, SSL authentication, message threading etc.


   It sounds like you need an SMTP receiving server and an SMTP sender,
not a user-type client.  See

http://docs.python.org/library/smtpd.html

for a simple server that will handle incoming messages, and

http://docs.python.org/library/smtplib.html 

for an SMTP sender that can reply to them.  Those are standard
Python functions.

You can run this on most server-type machines.  It's best
if you have an upstream server configured to do spam filtering
and forwarding to your server, or you'll get vast amounts of
junk coming into your system.

Have the upstream machine forward to a nonstandard mail
port (like example.com:2525) if the server machine already
has a mail server. This will allow the existing mail server to
run.

John Nagle


--
http://mail.python.org/mailman/listinfo/python-list


Re: Remove whitespaces and line breaks in a XML file

2011-02-07 Thread Stefan Behnel

David Vicente, 07.02.2011 18:45:

I´m parsing an xml file with xml.etree. It works correctly, but I have a
problem with the text attribute of the elements which should be empty. For
example, in this case:

book

 authorKenauthor

/book



The text element of “book” should be empty, but it returns me some
whitespaces and break lines. I can´t get remove these whitespaces without
remove information.


Only a DTD (or schema) can provide the information which whitespace in an 
XML document is meaningful and which isn't, so there is no generic way to 
do it right, especially not for something as generic as an XML parser.


What may work for you is to check if an Element has children and only 
whitespace as text (not el.text or not el.text.strip()), and only then 
replace it by None.


Stefan

--
http://mail.python.org/mailman/listinfo/python-list


Re: splitting by double newline

2011-02-07 Thread Nikola Skoric
Dana Mon, 07 Feb 2011 19:20:38 +0100, 
Peter Otten __pete...@web.de kaze:
 with open(filename, U) as f:

Oh, fabulous. Thanks!

-- 
Now the storm has passed over me
I'm left to drift on a dead calm sea
And watch her forever through the cracks in the beams
Nailed across the doorways of the bedrooms of my dreams
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Universal Feed Browser problem in feedparser.py

2011-02-07 Thread Miki Tebeka
   import feedparser
   d = feedparser.parse(http://feedparser.org/docs/examples/atom10.xml;)
This works for me, are you sure it's not a network problem in your side?
(what happens if you try to open this link in a browser?)
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: splitting by double newline

2011-02-07 Thread Nikola Skoric
Dana Mon, 7 Feb 2011 10:02:05 -0800 (PST), 
Ian ian.g.ke...@gmail.com kaze:
 self.tables = re.split(r'(?:\r\n){2,}|\r{2,}|\n{2,}', bulk)

Thanks!

I tried without ?:, but it didn't work. Can you tell me why is it
important that group is noncapturing?


-- 
Now the storm has passed over me
I'm left to drift on a dead calm sea
And watch her forever through the cracks in the beams
Nailed across the doorways of the bedrooms of my dreams
-- 
http://mail.python.org/mailman/listinfo/python-list


PIL Open Problem

2011-02-07 Thread Richard Holmes
I'm trying to create an image for use in Tkinter. If I understand the
PIL documentation correctly, I first need to import Image, then
create an instance of the Image class and call 'open' (this according
to the documentation). When I try to do this using the model in the
documentation, I get:

Traceback (most recent call last):
  File todo.py, line 202, in module
im = Image.open(cwd + r'\delete.GIF', 'r')
AttributeError: class Image has no attribute 'open'

where 'cwd' is the current working directory obtained using the os
module. When I import Image into IDLE and enter help(Image.open), IDLE
is quite happy to give me the info about the function.

Can someone point out to me the folly of my ways?

TIA!

Dick Holmes
-- 
http://mail.python.org/mailman/listinfo/python-list


Why not list = ftplib.FTP.dir() ?

2011-02-07 Thread trylks
I don't know if it is ftplib or just me, but something feels terribly wrong
in this:

from ftplib import FTP
 from functools import partial

 class MyFTP(FTP):
   def dir(self):
 l = []
 super(MyFTP, self).dir(partial(lambda l, e: l.append(e.split()), l))
 return l


Unfortunately 'MLSD' is not available in the server I have to use. (I need
to get the list of folders and files modified since last access, hence
split).

Cheers.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: PIL Open Problem

2011-02-07 Thread Corey Richardson
On 02/07/2011 05:27 PM, Richard Holmes wrote:
 I'm trying to create an image for use in Tkinter. If I understand the
 PIL documentation correctly, I first need to import Image, then
 create an instance of the Image class and call 'open'

Don't do that. This is wrong:

import Image
im = Image.Image()
im = im.open(foo)

This is good:

import Image
im = Image.open(foo)
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Why not list = ftplib.FTP.dir() ?

2011-02-07 Thread Ian Kelly
On Mon, Feb 7, 2011 at 3:26 PM, trylks try...@gmail.com wrote:
 I don't know if it is ftplib or just me, but something feels terribly wrong
 in this:

 from ftplib import FTP
 from functools import partial

 class MyFTP(FTP):
   def dir(self):
     l = []
     super(MyFTP, self).dir(partial(lambda l, e: l.append(e.split()), l))
     return l

No need to use partial here.  You can simplify that to:

super(MyFTP, self).dir(lambda e: l.append(e.split()))
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: PIL Open Problem

2011-02-07 Thread Ben Finney
Richard Holmes richa...@dslextreme.com writes:

 I'm trying to create an image for use in Tkinter. If I understand the
 PIL documentation correctly, I first need to import Image, then
 create an instance of the Image class and call 'open' (this according
 to the documentation). When I try to do this using the model in the
 documentation, I get:

Please show the code you used that generated this traceback.

 Traceback (most recent call last):
   File todo.py, line 202, in module
 im = Image.open(cwd + r'\delete.GIF', 'r')
 AttributeError: class Image has no attribute 'open'

The line of code shown in the traceback is calling the ‘open’ method on
the ‘Image’ class – which has no such method, as the error tells you.

 Can someone point out to me the folly of my ways?

It will be much easier when we see some code. Post a minimal, working
example that still shows the behaviour you want explained.

-- 
 \   “If you make people think they're thinking, they'll love you; |
  `\ but if you really make them think, they'll hate you.” —Donald |
_o__) Robert Perry Marquis |
Ben Finney
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: splitting by double newline

2011-02-07 Thread MRAB

On 07/02/2011 21:15, Nikola Skoric wrote:

Dana Mon, 7 Feb 2011 10:02:05 -0800 (PST),
Ianian.g.ke...@gmail.com  kaze:

self.tables = re.split(r'(?:\r\n){2,}|\r{2,}|\n{2,}', bulk)


Thanks!

I tried without ?:, but it didn't work. Can you tell me why is it
important that group is noncapturing?


The scanner uses capture groups to identify which part matched. If you
provide additional capture groups it has problems...
--
http://mail.python.org/mailman/listinfo/python-list


Re: PIL Open Problem

2011-02-07 Thread Richard Holmes
On Mon, 07 Feb 2011 17:28:45 -0500, Corey Richardson kb1...@aim.com
wrote:

On 02/07/2011 05:27 PM, Richard Holmes wrote:
 I'm trying to create an image for use in Tkinter. If I understand the
 PIL documentation correctly, I first need to import Image, then
 create an instance of the Image class and call 'open'

Don't do that. This is wrong:

import Image
im = Image.Image()
im = im.open(foo)

This is good:

import Image
im = Image.open(foo)
Uh, thanks, Corey, but that's what I'm doing. See Traceback:

Traceback (most recent call last):
  File todo.py, line 202, in module
im = Image.open(cwd + r'\delete.GIF', 'r')
AttributeError: class Image has no attribute 'open'

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: PIL Open Problem

2011-02-07 Thread Ben Finney
Richard Holmes richa...@dslextreme.com writes:

 On Mon, 07 Feb 2011 17:28:45 -0500, Corey Richardson kb1...@aim.com
 wrote:
 This is good:
 
 import Image
 im = Image.open(foo)
 Uh, thanks, Corey, but that's what I'm doing. See Traceback:

Without code, we can't see what you're doing.

Please post a minimal working example that demonstrates the behaviour
you want explained.

-- 
 \   “Always do right. This will gratify some people, and astonish |
  `\the rest.” —Mark Twain |
_o__)  |
Ben Finney
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: PIL Open Problem

2011-02-07 Thread Richard Holmes
On Tue, 08 Feb 2011 09:47:32 +1100, Ben Finney
ben+pyt...@benfinney.id.au wrote:

Richard Holmes richa...@dslextreme.com writes:

 I'm trying to create an image for use in Tkinter. If I understand the
 PIL documentation correctly, I first need to import Image, then
 create an instance of the Image class and call 'open' (this according
 to the documentation). When I try to do this using the model in the
 documentation, I get:

Please show the code you used that generated this traceback.

 Traceback (most recent call last):
   File todo.py, line 202, in module
 im = Image.open(cwd + r'\delete.GIF', 'r')
 AttributeError: class Image has no attribute 'open'

The line of code shown in the traceback is calling the ‘open’ method on
the ‘Image’ class – which has no such method, as the error tells you.

 Can someone point out to me the folly of my ways?

It will be much easier when we see some code. Post a minimal, working
example that still shows the behaviour you want explained.

Thanks, Ben. It turns out that I imported both Image and Tkinter and
Tkinter has an Image class that masked the Image class in the Image
module. I solved the problem by moving the Image code to a separate
module

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: socket.rcv timeout while-loop

2011-02-07 Thread Dwayne Blind
Dear Stephen,

Thanks for telling me this all looked very peculiar. As you said, it did not
really need solving.

Cheers,
Dwayne


2011/2/4 Stephen Hansen me+list/pyt...@ixokai.io

 On 2/4/11 9:16 AM, Dwayne Blind wrote:
  @ Stephen Hansen
  Now I am pretty much worried. :'(

 Why? This is all sounding like a problem that isn't actually a problem.

 I think you may have over-analyzed yourself into a corner and think you
 have something to solve which doesn't really need solving. :)

 --

   Stephen Hansen
   ... Also: Ixokai
   ... Mail: me+list/python (AT) ixokai (DOT) io
   ... Blog: http://meh.ixokai.io/


-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Remove whitespaces and line breaks in a XML file

2011-02-07 Thread Josh English
I found the code posted at 

http://infix.se/2007/02/06/gentlemen-indent-your-xml

quite helpful in turning my xml into human-readable structures. It works
best for XML-Data.

Josh
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: PIL Open Problem

2011-02-07 Thread rantingrick
On Feb 7, 5:35 pm, Richard Holmes richa...@dslextreme.com wrote:

 Thanks, Ben. It turns out that I imported both Image and Tkinter and
 Tkinter has an Image class that masked the Image class in the Image
 module. I solved the problem by moving the Image code to a separate
 module

Yes an another great example of why from Tkinter import * is a very
*very* bad idea. Use import Tkinter as tk to solve the dilemma. No
need to export code to another module. Next time you have an object
that should have an attribute but does not, print the repr() of the
object to find out what you are working with before clawing your
eyeballs out in frustration :).


 from Tkinter import *
 Image
class Tkinter.Image at 0x027429C0


use the repr() function in a script ... print repr(Image)
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: PIL Open Problem

2011-02-07 Thread Ben Finney
Richard Holmes richa...@dslextreme.com writes:

 Thanks, Ben. It turns out that I imported both Image and Tkinter and
 Tkinter has an Image class that masked the Image class in the Image
 module. I solved the problem by moving the Image code to a separate
 module

This is a classic problem known as “namespace clobbering”.

It is best to *avoid* the recommendations made in many libraries of
‘from foo import *’, because that will clobber any names in your
namespace that happen to match names in the ‘foo’ module.

Rather, import Tkinter and PIL as distinct namespaces::

 import PIL.Image
 import Tkinter as tk
 tk.Image
class Tkinter.Image at 0xf6d7f3c0
 PIL.Image
module 'PIL.Image' from
 '/usr/lib/python2.6/dist-packages/PIL/Image.pyc'

and then you know that none of the names from those modules will clobber
existing ones.

-- 
 \  “Those who write software only for pay should go hurt some |
  `\ other field.” —Erik Naggum, in _gnu.misc.discuss_ |
_o__)  |
Ben Finney
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Why not list = ftplib.FTP.dir() ?

2011-02-07 Thread rantingrick
On Feb 7, 4:48 pm, Ian Kelly ian.g.ke...@gmail.com wrote:
 On Mon, Feb 7, 2011 at 3:26 PM, trylks try...@gmail.com wrote:
  I don't know if it is ftplib or just me, but something feels terribly wrong
  in this:

  from ftplib import FTP
  from functools import partial

  class MyFTP(FTP):
    def dir(self):
      l = []
      super(MyFTP, self).dir(partial(lambda l, e: l.append(e.split()), l))
      return l

 No need to use partial here.  You can simplify that to:

 super(MyFTP, self).dir(lambda e: l.append(e.split()))

Why not...?

MyFTP.dir(self, lambda e: l.append(e.split()))

...super is not needed when you know the name of the object. And now
(without super) you can see the path of self just as Guido intended!
super can be super confusing to noobs.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: PIL Open Problem

2011-02-07 Thread Westley Martínez
On Mon, 2011-02-07 at 15:54 -0800, rantingrick wrote:

 On Feb 7, 5:35 pm, Richard Holmes richa...@dslextreme.com wrote:
 
  Thanks, Ben. It turns out that I imported both Image and Tkinter and
  Tkinter has an Image class that masked the Image class in the Image
  module. I solved the problem by moving the Image code to a separate
  module
 
 Yes an another great example of why from Tkinter import * is a very
 *very* bad idea. Use import Tkinter as tk to solve the dilemma. No
 need to export code to another module. Next time you have an object
 that should have an attribute but does not, print the repr() of the
 object to find out what you are working with before clawing your
 eyeballs out in frustration :).
 
 
  from Tkinter import *
  Image
 class Tkinter.Image at 0x027429C0
 
 
 use the repr() function in a script ... print repr(Image)

Or just print(Image). print() automatically calls str() on an object.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: PIL Open Problem

2011-02-07 Thread Richard Holmes
On Tue, 08 Feb 2011 10:56:52 +1100, Ben Finney
ben+pyt...@benfinney.id.au wrote:

Richard Holmes richa...@dslextreme.com writes:

 Thanks, Ben. It turns out that I imported both Image and Tkinter and
 Tkinter has an Image class that masked the Image class in the Image
 module. I solved the problem by moving the Image code to a separate
 module

This is a classic problem known as “namespace clobbering”.

It is best to *avoid* the recommendations made in many libraries of
‘from foo import *’, because that will clobber any names in your
namespace that happen to match names in the ‘foo’ module.

Rather, import Tkinter and PIL as distinct namespaces::

 import PIL.Image
 import Tkinter as tk
 tk.Image
class Tkinter.Image at 0xf6d7f3c0
 PIL.Image
module 'PIL.Image' from
 '/usr/lib/python2.6/dist-packages/PIL/Image.pyc'

and then you know that none of the names from those modules will clobber
existing ones.

Thanks. Message understood.
-- 
http://mail.python.org/mailman/listinfo/python-list


smtpd bug?

2011-02-07 Thread Ben
I've been using smtpd.py to implement a kind of cowboy SMTP server
(only overriding process_message), and inevitably after a certain time
the server stops accepting incoming connections: the socket on which
it was formerly listening gets closed.

I ran it using strace and discovered that it would get ENOTCONN on
some just-accepted socket in a call to getpeername(), and then close
the *listening* socket.

This seems to be caused by the line
   channel = SMTPChannel(self, conn, addr)
in smtpd.py and handle_error() in the definition of
asyncore.dispatcher, which finishes by calling self.handle_close()
[1]. The result of this is that when the call to getpeername() in the
constructor for SMTPChannel raises ENOTCONN (or any other exception),
it unwinds via asyncore.dispatcher.handle_read_event(), to
asyncore.read(), where the SMTPServer instance gets its handle_error
method called on it, eventually closing its listening socket. But the
error was in the socket we just accepted---not the listening socket.

[1] I'm actually using python2.4, since that's what's installed on the
server; there, the handle_error() method simply finishes by calling
self.close(). In fact, AFAICT, there's another problem in 3.1: neither
asyncore.dispatcher nor smtpd.SMTPServer (nor any of its subclasses in
smtpd.py) defines a method handle_close(); asyncore.dispatcher passes
attribute lookups to its socket object via __getattr__, but sockets
don't have a handle_close method either---so it seems as if, if
handle_close() is ever called, it'll just generate a new error.
-- 
http://mail.python.org/mailman/listinfo/python-list


[issue11129] logging: allow multiple entries in qualname config

2011-02-07 Thread Vinay Sajip

Vinay Sajip vinay_sa...@yahoo.co.uk added the comment:

There's no particularly good use case for this. Plus, going forwards, 
dictionary-based configuration should be used (as it supports more logging 
features).

--
nosy: +vinay.sajip
resolution:  - wont fix
status: open - closed

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue11129
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue11129] logging: allow multiple entries in qualname config

2011-02-07 Thread Vinay Sajip

Changes by Vinay Sajip vinay_sa...@yahoo.co.uk:


--
assignee:  - vinay.sajip

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue11129
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue11128] decimal.py: to_integral() corner cases

2011-02-07 Thread Stefan Krah

Stefan Krah stefan-use...@bytereef.org added the comment:

For the record, I prefer Python's behavior. The quantize() definition
does not work well for arbitrary precision input and leads to situations
like:


Precision: 1
Maxexponent: 1
Minexponent: -1

tointegral  101  -  101
tointegral  101.0  -  NaN  Invalid_operation


A comment in tointegral.decTest suggests that the to-integral definition 
was modeled after IEEE 854 and 754r:

-- This set of tests tests the extended specification 'round-to-integral
-- value' operation (from IEEE 854, later modified in 754r).
-- All non-zero results are defined as being those from either copy or
-- quantize, so those are assumed to have been tested.
-- Note that 754r requires that Inexact not be set, and we similarly
-- assume Rounded is not set.


This definition of course works fine as long as the input does not
have more than 'precision' digits and Emax is sufficiently large. I
think that for arbitrary precision input the definition should read:


Otherwise (the operand has a negative exponent) the result is the
 same as using the quantize operation using the given operand as the
 left-hand-operand and 1E+0 as the right-hand-operand. For the purpose
 of quantizing a temporary context is used with the precision of the
 operand as the precision setting, Emax = prec and Emin = -Emax. The
 rounding mode is taken from the context, as usual.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue11128
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue11138] Docs: incollect example: fill and align

2011-02-07 Thread Georg Brandl

Georg Brandl ge...@python.org added the comment:

Thanks, fixed in r88364.

--
nosy: +georg.brandl
resolution:  - fixed
status: open - closed

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue11138
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue8691] Doc: left alignment is not the default for numbers

2011-02-07 Thread Georg Brandl

Georg Brandl ge...@python.org added the comment:

Fixed in r88365.

--
resolution:  - fixed
status: open - closed

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue8691
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue11079] Make OS X entry in Applications like that in Windows

2011-02-07 Thread Georg Brandl

Georg Brandl ge...@python.org added the comment:

Same here: can't test it, but if you test it successfully and the installer 
runs, this is good for 3.2.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue11079
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue11132] compileall.compile_dir loses 'optimize' parameter in recursion.

2011-02-07 Thread Georg Brandl

Georg Brandl ge...@python.org added the comment:

Thanks, fixed in r88366.

--
resolution:  - fixed
status: open - closed

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue11132
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue11079] Make OS X entry in Applications like that in Windows

2011-02-07 Thread Georg Brandl

Georg Brandl ge...@python.org added the comment:

Same here: can't test it, but if you test it successfully and the installer 
runs, this is good for 3.2.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue11079
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue11116] mailbox and email errors

2011-02-07 Thread Georg Brandl

Georg Brandl ge...@python.org added the comment:

 The traceback from email.generator is unfortunate.  I should have
 message_from-string reject non-ASCII input with a clear error message
 like mailbox.add does now, but I didn't think of it.  I will see if
 the release manager will let me make that change.

Sounds like a good change.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue6
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue11134] Add missing type slots

2011-02-07 Thread Georg Brandl

Georg Brandl ge...@python.org added the comment:

I'm sure Martin has now carefully checked all the remaining slots and these 
three are the last ones to be added :)

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue11134
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com




[issue11135] Redundant doc field in TypeSpec

2011-02-07 Thread Georg Brandl

Georg Brandl ge...@python.org added the comment:

Looks good.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue11135
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue7719] distutils: ignore .nfsXXXX files

2011-02-07 Thread Michael Haubenwallner

Changes by Michael Haubenwallner michael.haubenwall...@salomon.at:


--
nosy: +haubi

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue7719
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue10882] Add os.sendfile()

2011-02-07 Thread Giampaolo Rodola'

Giampaolo Rodola' g.rod...@gmail.com added the comment:

I was testing against FreeBSD 7.0 RC1 and I confirm the problem doesn't occur 
on 8.1 version. Patch in attachment adds test for flags argument and skips 
headers/trailers tests on linux and solaris.
I'm ok for committing this as-is in 3.3.

--
resolution:  - accepted
status: open - pending
Added file: http://bugs.python.org/file20708/sendfile_v7.patch

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue10882
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue11131] decimal.py: plus/minus with ROUND_FLOOR

2011-02-07 Thread Stefan Krah

Stefan Krah stefan-use...@bytereef.org added the comment:

The patch and the test cases look good, but the implicit context must
be looked up earlier now (see the altered patch).

I just realize that there aren't any regression tests for this sort
of situation, since for the main tests we are only testing the context
methods.

--
Added file: http://bugs.python.org/file20709/issue11131-2.patch

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue11131
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue10882] Add os.sendfile()

2011-02-07 Thread Antoine Pitrou

Antoine Pitrou pit...@free.fr added the comment:

Please leave open until a patch is actually committed ;)

--
status: pending - open

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue10882
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue7719] distutils: ignore .nfsXXXX files

2011-02-07 Thread SilentGhost

SilentGhost ghost@gmail.com added the comment:

Here is the applicable patch against py3k branch.

--
nosy: +SilentGhost
Added file: http://bugs.python.org/file20710/dir_util.py.diff

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue7719
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue11139] subprocess: Arguments to .bat scripts get interpreted by shell

2011-02-07 Thread Arve Knudsen

New submission from Arve Knudsen arve.knud...@gmail.com:

As a regression from Python 2.6, when running .bat scripts on Windows with 
f.ex. subprocess.call under Python 2.7.1, arguments get interpreted by the 
shell. This bit me in the way that I could no longer pass arguments containing 
the character '|' to .bat scripts, something that works fine under Python 2.6.

To see the bug in action, run tst.py in the attached case.zip with Python 
2.7.1. The case also demonstrates that the '|' character only gets interpreted 
when launching cmd scripts, not e.g. python.exe.

--
components: Library (Lib)
files: case.zip
messages: 128119
nosy: Arve.Knudsen
priority: normal
severity: normal
status: open
title: subprocess: Arguments to .bat scripts get interpreted by shell
type: behavior
versions: Python 2.7
Added file: http://bugs.python.org/file20711/case.zip

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue11139
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue10971] python Lib/test/regrtest.py -R 3:3: test_zipimport_support fails

2011-02-07 Thread Nick Coghlan

Nick Coghlan ncogh...@gmail.com added the comment:

Fixed for 3.2 in r88368 (no backport needed, since the older test suites didn't 
exhibit the original problem with the _ssl module reloading)

--
resolution:  - fixed
status: open - closed

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue10971
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue10971] python Lib/test/regrtest.py -R 3:3: test_zipimport_support fails

2011-02-07 Thread Nick Coghlan

Nick Coghlan ncogh...@gmail.com added the comment:

(Georg reviewed the patch after I mentioned it to him on IRC)

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue10971
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue11139] subprocess: Arguments to .bat scripts get interpreted by shell

2011-02-07 Thread SilentGhost

Changes by SilentGhost ghost@gmail.com:


--
versions: +Python 3.1, Python 3.2, Python 3.3

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue11139
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue8637] Add PYDOCPAGER envvar to specify pager for pydoc

2011-02-07 Thread Justin Bronder

Justin Bronder jsbron...@gentoo.org added the comment:

On Thu, Feb 3, 2011 at 7:39 PM, Éric Araujo rep...@bugs.python.org wrote:
..
 Justin: what exactly is a pager that does not support man pages?

vimpager is the one I'm using.  For man pages there's vimmanpager.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue8637
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue8637] Add PYDOCPAGER envvar to specify pager for pydoc

2011-02-07 Thread Éric Araujo

Éric Araujo mer...@netwok.org added the comment:

Excuse me if I was unclear: I wasn’t asking for program names but for a 
definition of “don’t support” or description of problematic behavior.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue8637
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue8637] Add PYDOCPAGER envvar to specify pager for pydoc

2011-02-07 Thread Antoine Pitrou

Antoine Pitrou pit...@free.fr added the comment:

Reusing MANPAGER is practical. Yet another PY* environment variable doesn't 
seem warranted in this case.
Agreed with Alexander's simpler logic proposal in msg105153.

--
nosy: +pitrou

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue8637
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue11139] subprocess: Arguments to .bat scripts get interpreted by shell

2011-02-07 Thread SilentGhost

SilentGhost ghost@gmail.com added the comment:

This seem to have been discussed in issue8972: closing as a duplicate.

--
nosy: +SilentGhost
resolution:  - duplicate
status: open - closed

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue11139
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue11136] imaplib IMAP4_SSL shutdown gets socket error in py 3.2

2011-02-07 Thread Antoine Pitrou

Changes by Antoine Pitrou pit...@free.fr:


--
status: pending - closed

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue11136
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue8637] Add PYDOCPAGER envvar to specify pager for pydoc

2011-02-07 Thread Justin Bronder

Justin Bronder jsbron...@gentoo.org added the comment:

 Éric Araujo mer...@netwok.org added the comment:
 
 Excuse me if I was unclear: I wasn’t asking for program names but for a 
 definition of “don’t support” or description of problematic behavior.

In headers with vimpager ^H is not rendered(?) correctly.

For instance, 'pydoc os' shows:

---
Help on module os:

N^HNA^HAM^HME^HE

F^HFI^HIL^HLE^HE
/usr/lib/python2.6/os.py

---

And so on.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue8637
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue8972] subprocess.list2cmdline doesn't quote the character

2011-02-07 Thread SilentGhost

SilentGhost ghost@gmail.com added the comment:

issue11139 was closed as a duplicate of this issue.

--
nosy: +SilentGhost

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue8972
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue11140] Error in the documentation of threading.Lock().release()

2011-02-07 Thread aaugustin

New submission from aaugustin aymeric.augus...@polyconseil.fr:

The docs for the threading module state that:

 The release() method should only be called in the locked state; it changes 
 the state to unlocked and returns immediately. If an attempt is made to 
 release an unlocked lock, a RuntimeError will be raised.

However, I noticed that catching RuntimeError does not work. Actually release() 
raises thread.error, which inherits directly Exception.

I reproduced the behavior shown below in Python 2.6.6, 2.7.1 from MacPorts on 
Mac OS 10.6 and in Python 2.6.6 on Linux. The same happens in Python 3.2rc2 on 
Mac OS 10.6, except the thread module has been renamed to _thread so the 
exception becomes a _thread.error.

 import threading

 try:
... threading.Lock().release()
... except RuntimeError:
... pass
... 
Traceback (most recent call last):
  File stdin, line 2, in module
thread.error: release unlocked lock

 try:
... threading.Lock().release()
... except Exception, e:
... print type(e)
... print type(e).mro()
... 
class 'thread.error'
[class 'thread.error', type 'exceptions.Exception', type 
'exceptions.BaseException', type 'object']

I do not know if this must be fixed in the docs or the code. Currently, the 
type of the exception is probably platform-dependant since the thread module is 
not provided on all platforms.

--
components: Library (Lib)
messages: 128128
nosy: aaugustin
priority: normal
severity: normal
status: open
title: Error in the documentation of threading.Lock().release()
versions: Python 2.6, Python 2.7

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue11140
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue11139] subprocess: Arguments to .bat scripts get interpreted by shell

2011-02-07 Thread R. David Murray

R. David Murray rdmur...@bitdance.com added the comment:

Well, it's not really a duplicate, but rather invalid, since the 2.7 behavior 
is more correct than the 2.6 behavior.  Not that it matters all that much what 
particular resolution is attached to a bug.

Arve: It is unfortunate that the bug fix in issue 8972 caused a regression for 
you, but at this point what is done is done.

Also, for future reference, when attaching files to an issue please attach text 
files only.  They are much easier to review.

--
nosy: +r.david.murray
resolution: duplicate - invalid
stage:  - committed/rejected
superseder:  - subprocess.list2cmdline doesn't quote the  character

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue11139
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue11140] threading.Lock().release() raises _thread.error, not RuntimeError

2011-02-07 Thread Antoine Pitrou

Antoine Pitrou pit...@free.fr added the comment:

I would rather make _thread.error an alias of RuntimeError. That way, we can 
reconcile the docs and the code without breaking compatibility.
Also, importing _thread won't be necessary to catch errors raised in threading 
objects.

--
nosy: +gregory.p.smith, pitrou
stage:  - needs patch
title: Error in the documentation of threading.Lock().release() - 
threading.Lock().release() raises _thread.error, not RuntimeError
type:  - behavior
versions: +Python 3.3 -Python 2.6, Python 2.7

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue11140
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue11140] threading.Lock().release() raises _thread.error, not RuntimeError

2011-02-07 Thread aaugustin

aaugustin aymeric.augus...@polyconseil.fr added the comment:

I agree with your solution. Unfortunately, I do not know how you would redefine 
ThreadError to extend RuntimeError in a C extension.

_thread.error is created line 741 in trunk/Modules/threadmodule.c:
ThreadError = PyErr_NewException(thread.error, NULL, NULL);


dummy_thread.error is created lin 21 in trunk/Lib/dummy_thread.py:
class error(Exception):
...

Changing this to RuntimeException is trivial.


I don't think there are other implementations of threading in the Python source 
but I'd appreciate if someone more familiar with the interpreter could confirm.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue11140
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue11137] clarify use of imaplib IMAP4(_SSL) shutdown

2011-02-07 Thread Antoine Pitrou

Antoine Pitrou pit...@free.fr added the comment:

Ok, clarified in r88371. Thank you!

--
nosy: +pitrou
resolution:  - fixed
stage:  - committed/rejected
status: open - closed
versions: +Python 2.7, Python 3.1

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue11137
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue11140] threading.Lock().release() raises _thread.error, not RuntimeError

2011-02-07 Thread Antoine Pitrou

Antoine Pitrou pit...@free.fr added the comment:

 aaugustin aymeric.augus...@polyconseil.fr added the comment:
 
 I agree with your solution. Unfortunately, I do not know how you would
 redefine ThreadError to extend RuntimeError in a C extension.
 
 _thread.error is created line 741 in trunk/Modules/threadmodule.c:
 ThreadError = PyErr_NewException(thread.error, NULL, NULL);

I was not proposing to extend it, just to alias it:

ThreadError = PyExc_RuntimeError;
Py_INCREF(ThreadError);

That said, extending is quite trivial if the behaviour is not changed:

ThreadError = PyErr_NewException(thread.error, PyExc_RuntimeError,
NULL);

(see
http://docs.python.org/dev/c-api/exceptions.html#PyErr_NewException)

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue11140
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue9334] argparse does not accept options taking arguments beginning with dash (regression from optparse)

2011-02-07 Thread Eric Smith

Eric Smith e...@trueblade.com added the comment:

Steven: Yes, the current structure of the first pass scan makes any patch 
problematic. It really would be an implementation of a different algorithm.

I'm still interested in looking at it, though.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue9334
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue11139] subprocess: Arguments to .bat scripts get interpreted by shell

2011-02-07 Thread Arve Knudsen

Arve Knudsen arve.knud...@gmail.com added the comment:

Would you mind defining why the 2.7 behaviour is correct in this particular
case? The list2cmdline behaviour discussed in issue 8972 has to do with
shell commandlines; in this case, in my eyes any shell invocation (in order
to run a .bat I guess) is only an implementation detail. Is the 2.7
behaviour correct since the Win32 function CreateProcess happens to start a
shell to run .bat files, which in turn interprets the arguments? I'm
guessing this is what happens...

There certainly can't be any universal definition in subprocess saying that
arguments to shell scripts shall be interpreted by the shell; when trying
now *on Linux* to launch a corresponding .sh script through subprocess,
arguments are passed through verbatim. I should like to see subprocess
maintain (or keep maintaining, rather) a uniform interface, so that
arguments are not interpreted so long as the 'shell' argument equals False.

I understand completely that list2cmdline should implement C library
behaviour, and not protect arguments from the shell, but that doesn't mean
it should automatically define the behaviour of other functions such as
Popen and call.

Arve

On Mon, Feb 7, 2011 at 4:38 PM, R. David Murray rep...@bugs.python.orgwrote:


 R. David Murray rdmur...@bitdance.com added the comment:

 Well, it's not really a duplicate, but rather invalid, since the 2.7
 behavior is more correct than the 2.6 behavior.  Not that it matters all
 that much what particular resolution is attached to a bug.

 Arve: It is unfortunate that the bug fix in issue 8972 caused a regression
 for you, but at this point what is done is done.

 Also, for future reference, when attaching files to an issue please attach
 text files only.  They are much easier to review.

 --
 nosy: +r.david.murray
 resolution: duplicate - invalid
 stage:  - committed/rejected
 superseder:  - subprocess.list2cmdline doesn't quote the  character

 ___
 Python tracker rep...@bugs.python.org
 http://bugs.python.org/issue11139
 ___


--
Added file: http://bugs.python.org/file20712/unnamed

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue11139
___Would you mind defining why the 2.7 behaviour is correct in this particular 
case? The list2cmdline behaviour discussed in issue 8972 has to do with shell 
commandlines; in this case, in my eyes any shell invocation (in order to run a 
.bat I guess) is only an implementation detail. Is the 2.7 behaviour correct 
since the Win32 function CreateProcess happens to start a shell to run .bat 
files, which in turn interprets the arguments? I#39;m guessing this is what 
happens...div
br/divdivThere certainly can#39;t be any universal definition in 
subprocess saying that arguments to shell scripts shall be interpreted by the 
shell; when trying now *on Linux* to launch a corresponding .sh script through 
subprocess, arguments are passed through verbatim. I should like to see 
subprocess maintain (or keep maintaining, rather) a uniform interface, so that 
arguments are not interpreted so long as the #39;shell#39; argument equals 
False./div
divbr/divdivI understand completely that list2cmdline should implement 
C library behaviour, and not protect arguments from the shell, but that 
doesn#39;t mean it should automatically define the behaviour of other 
functions such as Popen and call./div
divbr/divdivArvebrbrdiv class=gmail_quoteOn Mon, Feb 7, 2011 at 
4:38 PM, R. David Murray span dir=ltrlt;a 
href=mailto:rep...@bugs.python.org;rep...@bugs.python.org/agt;/span 
wrote:brblockquote class=gmail_quote style=margin:0 0 0 
.8ex;border-left:1px #ccc solid;padding-left:1ex;
br
R. David Murray lt;a 
href=mailto:rdmur...@bitdance.com;rdmur...@bitdance.com/agt; added the 
comment:br
br
Well, it#39;s not really a duplicate, but rather invalid, since the 2.7 
behavior is more correct than the 2.6 behavior.  Not that it matters all that 
much what particular resolution is attached to a bug.br
br
Arve: It is unfortunate that the bug fix in issue 8972 caused a regression for 
you, but at this point what is done is done.br
br
Also, for future reference, when attaching files to an issue please attach text 
files only.  They are much easier to review.br
br
--br
nosy: +r.david.murraybr
resolution: duplicate -gt; invalidbr
stage:  -gt; committed/rejectedbr
superseder:  -gt; subprocess.list2cmdline doesn#39;t quote the amp; 
characterbr
divdiv/divdiv class=h5br
___br
Python tracker lt;a 
href=mailto:rep...@bugs.python.org;rep...@bugs.python.org/agt;br
lt;a href=http://bugs.python.org/issue11139; 
target=_blankhttp://bugs.python.org/issue11139/agt;br
___br
/div/div/blockquote/divbr/div
___
Python-bugs-list 

[issue11131] decimal.py: plus/minus with ROUND_FLOOR

2011-02-07 Thread Mark Dickinson

Mark Dickinson dicki...@gmail.com added the comment:

Ah, good point about the context;  thanks for the updated patch.

Yes, those missing regression tests are a problem;  this isn't the first time 
that the above problem has appeared.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue11131
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue11079] Make OS X entry in Applications like that in Windows

2011-02-07 Thread Ned Deily

Ned Deily n...@acm.org added the comment:

Committed in r88374 and r88375 to py3k for 3.2 and the documentation links part 
only in r88376 to 27 for release in 2.7.2.

--
resolution:  - fixed
stage: commit review - committed/rejected
status: open - closed

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue11079
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue11104] distutils sdist ignores MANIFEST

2011-02-07 Thread John Dennis

Changes by John Dennis jden...@redhat.com:


--
nosy: +dmalcolm

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue11104
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue11141] 2.x range() in 3.x shelve documentation

2011-02-07 Thread Daniel Urban

New submission from Daniel Urban urban.dani...@gmail.com:

The example in the shelve documentation 
(http://docs.python.org/dev/py3k/library/shelve.html#example) uses the old 
range() (which returned a list):

d['xx'] = range(4)  # this works as expected, but...
d['xx'].append(5)   # *this doesn't!* -- d['xx'] is STILL range(4)!

--
assignee: docs@python
components: Documentation
messages: 128138
nosy: docs@python, durban
priority: normal
severity: normal
status: open
title: 2.x range() in 3.x shelve documentation
versions: Python 3.1, Python 3.2

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue11141
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue11139] subprocess: Arguments to .bat scripts get interpreted by shell

2011-02-07 Thread R. David Murray

R. David Murray rdmur...@bitdance.com added the comment:

The point is that subprocess (now!) is *not* interpreting the arguments when 
shell is false.  It is passing them through to Windows.  What windows does with 
them after that is out of the control of subprocess (and always has been).

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue11139
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue11141] 2.x range() in 3.x shelve documentation

2011-02-07 Thread SilentGhost

SilentGhost ghost@gmail.com added the comment:

Here is the patch.

--
keywords: +needs review, patch
nosy: +SilentGhost
versions: +Python 3.3
Added file: http://bugs.python.org/file20713/shelve.rst.diff

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue11141
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue11142] xmlrpclib.ServerProxy with verbosity produces bad output

2011-02-07 Thread Erez Sh

New submission from Erez Sh ere...@gmail.com:

In xmlrpclib, a ServerProxy initialized with verbose=True produces an 
occasionally jumbled-up output, due to a multiple threads writing to stdout 
without synchronizing.

I noticed this happening only for incoming data (at line 1461: 
print body:, repr(data) ).

I seem to have fixed it locally by accumulating all the data and printing it 
(within a lock) outside of the send/recv loop.

It is a useful feature for debugging and logging the 'raw' communication, but 
virtually useless if one can't rely on its output.

--
components: Library (Lib)
messages: 128141
nosy: Erez.Sh
priority: normal
severity: normal
status: open
title: xmlrpclib.ServerProxy with verbosity produces bad output
versions: Python 2.7

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue11142
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue11143] Issue with the issue tracker

2011-02-07 Thread Armin Rigo

New submission from Armin Rigo ar...@users.sourceforge.net:

Should I report it here?  The issue is with this issue tracker itself.  If we 
search for 2147483647 using the search box on this site (look up to the 
right), then it works; but if we search for 2147483648 or a bigger number 
(without the quotes), then we get an internal error :-)

--
messages: 128142
nosy: arigo
priority: normal
severity: normal
status: open
title: Issue with the issue tracker

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue11143
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue11144] int(float) may return a long for no reason

2011-02-07 Thread Armin Rigo

New submission from Armin Rigo ar...@users.sourceforge.net:

On 32 bits, there is no reason to get a 'long' here:

 int(float(sys.maxint))
2147483647L
 int(int(float(sys.maxint)))
2147483647
 int(float(-sys.maxint-1))
-2147483648L
 int(int(float(-sys.maxint-1)))
-2147483648

On 64 bits, it's another story because floats cannot store 64 bits of 
precision.  However, -sys.maxint-1 can still be represented exactly in a float, 
and the same issue occurs:

 int(float(-sys.maxint-1))
-9223372036854775808L
 int(int(float(-sys.maxint-1)))
-9223372036854775808

--
components: Interpreter Core
messages: 128143
nosy: arigo
priority: normal
severity: normal
status: open
title: int(float) may return a long for no reason
versions: Python 2.7

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue11144
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue11141] 2.x range() in 3.x shelve documentation

2011-02-07 Thread Raymond Hettinger

Changes by Raymond Hettinger rhettin...@users.sourceforge.net:


--
assignee: docs@python - 
resolution:  - accepted

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue11141
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue11139] subprocess: Arguments to .bat scripts get interpreted by shell

2011-02-07 Thread Arve Knudsen

Arve Knudsen arve.knud...@gmail.com added the comment:

I wasn't saying that subprocess is interpreting the arguments, but that the
shell is. Which was highly unexpected to me when outside of shell mode
(i.e., shell == False). From some further testing, though, I see that the
transformation from sequence to command line on Windows plays a bigger role
than I was aware of even though I've used subprocess since it was introduced
in the standard library. That is, I see that also in Python 2.6, arguments
to .bat scripts get interpreted if command arguments are passed to
subprocess as a string rather in a list.

My current conclusion is that there has been a hole in the subprocess design
the whole time, so that my case (start a Windows shell script like an
executable) has just worked by chance, due to that I have passed arguments
as a list which then got implicitly protected (even outside of shell mode).
Maybe subprocess.Popen should take another option to implement the old
behaviour of protecting arguments supplied as a list, given that this should
be a common enough case?

Arve

On Mon, Feb 7, 2011 at 6:06 PM, R. David Murray rep...@bugs.python.orgwrote:


 R. David Murray rdmur...@bitdance.com added the comment:

 The point is that subprocess (now!) is *not* interpreting the arguments
 when shell is false.  It is passing them through to Windows.  What windows
 does with them after that is out of the control of subprocess (and always
 has been).

 --

 ___
 Python tracker rep...@bugs.python.org
 http://bugs.python.org/issue11139
 ___


--
Added file: http://bugs.python.org/file20714/unnamed

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue11139
___I wasn#39;t saying that subprocess is interpreting the arguments, but that the 
shell is. Which was highly unexpected to me when outside of shell mode (i.e., 
shell == False). From some further testing, though, I see that the 
transformation from sequence to command line on Windows plays a bigger role 
than I was aware of even though I#39;ve used subprocess since it was 
introduced in the standard library. That is, I see that also in Python 2.6, 
arguments to .bat scripts get interpreted if command arguments are passed to 
subprocess as a string rather in a list.div
br/divdivMy current conclusion is that there has been a hole in the 
subprocess design the whole time, so that my case (start a Windows shell script 
like an executable) has just worked by chance, due to that I have passed 
arguments as a list which then got implicitly protected (even outside of shell 
mode). Maybe subprocess.Popen should take another option to implement the old 
behaviour of protecting arguments supplied as a list, given that this should be 
a common enough case?/div
divbr/divdivArvebrbrdiv class=gmail_quoteOn Mon, Feb 7, 2011 at 
6:06 PM, R. David Murray span dir=ltrlt;a 
href=mailto:rep...@bugs.python.org;rep...@bugs.python.org/agt;/span 
wrote:brblockquote class=gmail_quote style=margin:0 0 0 
.8ex;border-left:1px #ccc solid;padding-left:1ex;
div class=imbr
R. David Murray lt;a 
href=mailto:rdmur...@bitdance.com;rdmur...@bitdance.com/agt; added the 
comment:br
br
/divThe point is that subprocess (now!) is *not* interpreting the arguments 
when shell is false.  It is passing them through to Windows.  What windows 
does with them after that is out of the control of subprocess (and always has 
been).br

br
--br
divdiv/divdiv class=h5br
___br
Python tracker lt;a 
href=mailto:rep...@bugs.python.org;rep...@bugs.python.org/agt;br
lt;a href=http://bugs.python.org/issue11139; 
target=_blankhttp://bugs.python.org/issue11139/agt;br
___br
/div/div/blockquote/divbr/div
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue11139] subprocess: Arguments to .bat scripts get interpreted by shell

2011-02-07 Thread SilentGhost

Changes by SilentGhost ghost@gmail.com:


Removed file: http://bugs.python.org/file20712/unnamed

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue11139
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue11139] subprocess: Arguments to .bat scripts get interpreted by shell

2011-02-07 Thread SilentGhost

Changes by SilentGhost ghost@gmail.com:


Removed file: http://bugs.python.org/file20714/unnamed

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue11139
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue11139] subprocess: Arguments to .bat scripts get interpreted by shell

2011-02-07 Thread R. David Murray

R. David Murray rdmur...@bitdance.com added the comment:

As noted in issue 8972, it's not clear what such a mode should actually do.  If 
you have a concrete proposal you could make it, probably on the python-ideas 
mailing list.  But I'm personally not in favor of it; I prefer maintaining as 
much API consistency between windows and linux as we reasonably can.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue11139
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue11143] Issue with the issue tracker

2011-02-07 Thread R. David Murray

R. David Murray rdmur...@bitdance.com added the comment:

There is a link 'report tracker problem' at the bottom of the left hand column. 
 Unfortunately you have to create an account there to submit an issue :(

--
nosy: +r.david.murray
resolution:  - invalid
stage:  - committed/rejected
status: open - closed

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue11143
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue11139] subprocess: Arguments to .bat scripts get interpreted by shell

2011-02-07 Thread Arve Knudsen

Arve Knudsen arve.knud...@gmail.com added the comment:

The non-obvious thing with 8972 is what to do with an argument list when the
'shell' option is True, isn't it? I can't see how it overlaps with my case.
My suggestion is a flag to enable argument protection in Popen, either just
for arguments passed as a list (i.e., like how it's done in 2.6) or maybe
also for the case where you pass the command as a string (I haven't
considered that case yet, since it's not directly interesting to me).

I can actually see that exarkun suggests something along the same lines in
8972: 'implement the cmd.exe quoting rules in a different function from the
MS C runtime rules'.

Arve

On Mon, Feb 7, 2011 at 7:19 PM, R. David Murray rep...@bugs.python.orgwrote:


 R. David Murray rdmur...@bitdance.com added the comment:

 As noted in issue 8972, it's not clear what such a mode should actually do.
  If you have a concrete proposal you could make it, probably on the
 python-ideas mailing list.  But I'm personally not in favor of it; I prefer
 maintaining as much API consistency between windows and linux as we
 reasonably can.

 --

 ___
 Python tracker rep...@bugs.python.org
 http://bugs.python.org/issue11139
 ___


--
Added file: http://bugs.python.org/file20715/unnamed

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue11139
___The non-obvious thing with 8972 is what to do with an argument list when the 
#39;shell#39; option is True, isn#39;t it? I can#39;t see how it overlaps 
with my case. My suggestion is a flag to enable argument protection in Popen, 
either just for arguments passed as a list (i.e., like how it#39;s done in 
2.6) or maybe also for the case where you pass the command as a string (I 
haven#39;t considered that case yet, since it#39;s not directly interesting 
to me).div
br/divdivI can actually see that exarkun suggests something along the 
same lines in 8972: #39;implement the cmd.exe quoting rules in a different 
function from the MS C runtime rules#39;.divbr/divdivArvebr
brdiv class=gmail_quoteOn Mon, Feb 7, 2011 at 7:19 PM, R. David Murray 
span dir=ltrlt;a 
href=mailto:rep...@bugs.python.org;rep...@bugs.python.org/agt;/span 
wrote:brblockquote class=gmail_quote style=margin:0 0 0 
.8ex;border-left:1px #ccc solid;padding-left:1ex;
div class=imbr
R. David Murray lt;a 
href=mailto:rdmur...@bitdance.com;rdmur...@bitdance.com/agt; added the 
comment:br
br
/divAs noted in issue 8972, it#39;s not clear what such a mode should 
actually do.  If you have a concrete proposal you could make it, probably on 
the python-ideas mailing list.  But I#39;m personally not in favor of it; I 
prefer maintaining as much API consistency between windows and linux as we 
reasonably can.br

br
--br
divdiv/divdiv class=h5br
___br
Python tracker lt;a 
href=mailto:rep...@bugs.python.org;rep...@bugs.python.org/agt;br
lt;a href=http://bugs.python.org/issue11139; 
target=_blankhttp://bugs.python.org/issue11139/agt;br
___br
/div/div/blockquote/divbr/div/div
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue11145] '%o' % user-defined instance

2011-02-07 Thread Armin Rigo

New submission from Armin Rigo ar...@users.sourceforge.net:

The expression  '%o' % x,  where x is a user-defined instance, usually ignores 
a user-defined __oct__() method.  I suppose that's fine; assuming this is the 
expected behavior, then the present issue is about the usually in my previous 
sentence.

If 'x' is an instance of a subclass of 'long', then the __oct__() is called.  
It must be specifically a 'long' -- not, say, 'int' or 'str' or 'object'.  
Moreover, there is a test in test_format.py (class Foobar) that checks that if 
this __oct__() returns a non-string, then we get a nice TypeError.  That's 
already strange -- why is __oct__() called in the first place?  But trying out 
more I get (CPython 2.7.1):

 class X(long):
...   def __oct__(self):
... return 'abc'
... 
 '%o' % X()
Traceback (most recent call last):
  File stdin, line 1, in module
SystemError: ../trunk/Objects/stringobject.c:4035: bad argument to internal 
function

--
components: Interpreter Core
messages: 128148
nosy: arigo
priority: normal
severity: normal
status: open
title: '%o' % user-defined instance
versions: Python 2.7

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue11145
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue11129] logging: allow multiple entries in qualname config

2011-02-07 Thread anatoly techtonik

anatoly techtonik techto...@gmail.com added the comment:

Where is this configuration?

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue11129
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue11139] subprocess: Arguments to .bat scripts get interpreted by shell

2011-02-07 Thread R. David Murray

R. David Murray rdmur...@bitdance.com added the comment:

Yes, having a cmd.exe 'quote' function, parallel to the shutil 'quote' 
function, would be an excellent addition to the stdlib.  You could open a 
feature request for that.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue11139
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue11139] subprocess: Arguments to .bat scripts get interpreted by shell

2011-02-07 Thread Arve Knudsen

Arve Knudsen arve.knud...@gmail.com added the comment:

I'll keep it in mind.

On Mon, Feb 7, 2011 at 8:00 PM, R. David Murray rep...@bugs.python.orgwrote:


 R. David Murray rdmur...@bitdance.com added the comment:

 Yes, having a cmd.exe 'quote' function, parallel to the shutil 'quote'
 function, would be an excellent addition to the stdlib.  You could open a
 feature request for that.

 --

 ___
 Python tracker rep...@bugs.python.org
 http://bugs.python.org/issue11139
 ___


--
Added file: http://bugs.python.org/file20716/unnamed

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue11139
___I#39;ll keep it in mind.divbrdiv class=gmail_quoteOn Mon, Feb 7, 2011 
at 8:00 PM, R. David Murray span dir=ltrlt;a 
href=mailto:rep...@bugs.python.org;rep...@bugs.python.org/agt;/span 
wrote:brblockquote class=gmail_quote style=margin:0 0 0 
.8ex;border-left:1px #ccc solid;padding-left:1ex;
div class=imbr
R. David Murray lt;a 
href=mailto:rdmur...@bitdance.com;rdmur...@bitdance.com/agt; added the 
comment:br
br
/divYes, having a cmd.exe #39;quote#39; function, parallel to the shutil 
#39;quote#39; function, would be an excellent addition to the stdlib.  You 
could open a feature request for that.br
br
--br
divdiv/divdiv class=h5br
___br
Python tracker lt;a 
href=mailto:rep...@bugs.python.org;rep...@bugs.python.org/agt;br
lt;a href=http://bugs.python.org/issue11139; 
target=_blankhttp://bugs.python.org/issue11139/agt;br
___br
/div/div/blockquote/divbr/div
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue11145] '%o' % user-defined instance

2011-02-07 Thread Amaury Forgeot d'Arc

Amaury Forgeot d'Arc amaur...@gmail.com added the comment:

And this code will crash a debug build:

 class X(long):
... def __oct__(self):
... return 'foo'.upper()
...
 '%o' % X()
Assertion failed: buf[sign] == '0', file ..\..\Objects\stringobject.c, line 4059

--
nosy: +amaury.forgeotdarc

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue11145
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue11146] Add a feature similar to C++ using some_namespace

2011-02-07 Thread Manuel Bärenz

New submission from Manuel Bärenz man...@enigmage.de:

In C++, the the approach to the namespace problem is having different 
namespaces that should not contain different definitions of the same name.
Members of a namespace can be accessed explicitly by e.g. calling std::cout  
etc. or using namespace std; cout  etc.

I understand Pythons approach to be objects can be used as namespaces and 
their attributes are the names they contain. I find this a very beautiful way 
of solving the issue, but it has a downside, in my opinion, because it lacks 
the using directive from C++.

If the object is a module, we can of course do from mymodule import spam, 
eggs. But if it is not a module, this does not work.

Consider for example:

class Spam(object):
def frobnicate(self):
self.eggs = self.buy_eggs()
self.scrambled = self.scramble(self.eggs)
return self.scrambled  42

This could be easier to implement and read if we had something like:

class Spam(object):
def frobnicate(self):
using self:
eggs = buy_eggs()
scrambled = scramble(eggs)
return scrambled  42

Of course this opens a lot of conceptual questions like how should this using 
block behave if self doesn't have an attribute called eggs, but I think it is 
worth considering.

--
messages: 128153
nosy: turion
priority: normal
severity: normal
status: open
title: Add a feature similar to C++ using some_namespace
type: feature request

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue11146
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue11146] Add a feature similar to C++ using some_namespace

2011-02-07 Thread R. David Murray

R. David Murray rdmur...@bitdance.com added the comment:

This is a topic more suited to python-ideas.  It isn't likely to get much 
traction there, but you can try :)

--
nosy: +r.david.murray
resolution:  - rejected
stage:  - committed/rejected
status: open - closed

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue11146
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue969718] BASECFLAGS are not passed to module build line

2011-02-07 Thread Stefan Krah

Stefan Krah stefan-use...@bytereef.org added the comment:

Chris Lambacher rep...@bugs.python.org wrote:
 I was cross-compiling to a target architecture that does not support
 the -march option so I would not be able to provide a different one
 as override. 

Just out of curiosity: You are cross-compiling a C-extension? How can
you be sure that all values in pyconfig.h are correct?

 The debian-sysconfig-flags looks the most correct because it allows
 override at any point by emulating the CFLAGS = $(BASECFLAGS) $(OPT)
 $(EXTRA_CFLAGS) logic.
 
 It still looks like it needs an override for EXTRA_CFLAGS and the
 logic for LD_SHARED looks wrong. In the Makefile LDSHARED is just:
 LDSHARED=   $(CC) -shared -Wl,-O1 -Wl,-Bsymbolic-functions

I think Antoine is correct: EXTRA_CFLAGS show up as an empty string in
sysconfig (even if passed to configure and make), so there is no need
to override them.

As an aside, why do EXTRA_CFLAGS still exist in py3k when CFLAGS
can already be passed to configure and make?

I agree that the ldshared logic looks wrong. It is possible to specify
LDFLAGS via the environment, so why append CFLAGS. Changing this could
break existing build scripts though.

However, I don't see how the Debian patch could break anything, unless
someone relies on the fact that BASECFLAGS are suppressed in case CFLAGS
are given. I think the odds of this are virtually zero.

Any interest in a cleaned up version of the Debian patch (remove
double opt, line length, add documentation for overriding BASECFLAGS
and OPT)?

I'm asking, since I'm unsure about the degree of frozenness of distutils.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue969718
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue11145] '%o' % user-defined instance

2011-02-07 Thread Eric Smith

Changes by Eric Smith e...@trueblade.com:


--
nosy: +eric.smith

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue11145
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



  1   2   >