WSME 0.1.0a4 released

2011-10-13 Thread Christophe de Vienne

Hello,

I am happy to announce the release of WSME-0.1.0a4.


About WSME
--

WSME (Web Service Made Easy) is a very easy way to implement webservices
in your python web application (or standalone).


Changes
---

* Protocols can be added via entry_points
* Made the framework adapters easier to use

See also http://packages.python.org/WSME/changes.html


Documentation
-

http://packages.python.org/WSME/


Download


http://pypi.python.org/pypi/WSME



Cheers,

Christophe de Vienne
--
http://mail.python.org/mailman/listinfo/python-announce-list

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


Re: Usefulness of the not in operator

2011-10-13 Thread Jussi Piitulainen
Chris Angelico writes:
 On Sun, Oct 9, 2011 at 12:07 AM, Jussi Piitulainen wrote:
  But both negations can be avoided by modus tollens.
 
  If you are able to start the car, the key is in the ignition.
 
 But this translation implies looking at the result and ascertaining
 the state, which is less appropriate to a programming language. It's
 more like:
 
 If you found that you were able to start the car, the key must have
 been in the ignition.
 
 and is thus quite inappropriate to the imperative style. A
 functional language MAY be able to use this style, but Python wants
 to have the condition and then the action.

This is not in an imperative context. The context is (generalized)
Boolean expressions, where there should not be any action, just
expressions returning values that are combined to produce a
(generalized) Boolean value.

Defined order of evaluation and short-circuiting complicate the
picture, but as a matter of style, I think there should not be any
action part in such an expression. Usually.

And not in is fine as far as I am concerned.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Embedding a frame into a movie using python

2011-10-13 Thread J
 My objective is to have the user put together some images html and embed the 
 image as a frame into a video file (any embeddable format e.g. swf). 

SWF isn't the easiest format to work with; it's not necessarily a 
video, but might be a scripted object. Try working with real video 
formats such as avi, mpg, or ogv. 

You may wish to look into PiTiVi, an open source video editor; it's 
written in Python. I'm not sure if you can achieve what you want by 
simply driving PiTiVi externally, but at very least, it's worth a 
peek. 

ChrisA 

Hi Chris,

thank you for your response. I am format agnostic for processing so am happy to 
work with avi etc., however in displaying the final film to the user I think 
I'd need to convert whatever I've made to swf to make it a little less 
downloadable. I'll check out PiTiVi - perhaps I can hack it to work on the back 
of appengine...

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


Reading screen width of a Tkinter widget.

2011-10-13 Thread peter
I recently had a problem while trying to set up a Tkinter Canvas
widget as a progress bar.  Everything seemed to be working, except
that at 100% completion the progress bar spanned only about 75% of the
canvas width.  Eventually I tracked the problem down to the canvas bar
'width' property as read using w=cnvProgess['width'].  It turned out
the value returned was the original width of the canvas bar, and not
the screen width after the canvas had been gridded using 'sticky=W+E'.

Once I realised this it was not a show stopper, as I replaced the grid
sticky option with a specific width instruction.  But this is a bit
less flexible than my original method.  Is there any Tkinter command
which will return the actual dimensions of a widget which has had the
grid sticky option applied?

Peter

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


Opportunity missed by Python ?

2011-10-13 Thread candide

Dart is the very new language created by Google to replace Javascript.
So Python was not able to do the job? Or may be they don't know about 
Python at Google ;) ?

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


Re: Opportunity missed by Python ?

2011-10-13 Thread Andreas Neudecker
Am 13.10.2011 11:45, schrieb candide:
 Dart is the very new language created by Google to replace Javascript.
 So Python was not able to do the job? Or may be they don't know about
 Python at Google ;) ?

What needs to be done to make Python replace JS in Browsers/HTML? (or at
least make it a viable alternative to JS)

Can the Python community do this without involvment in browser development?

Regards

Andreas


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


Re: 1/2 evaluates to 0

2011-10-13 Thread Laurent Claessens



 Wohaw. This means that this behavior is going to be default in a
 foreseeable future ?


 It's the default in 3.x. I can't imagine it ever being the default in 2.x.



2.7 is now in bug-fix only mode, so no new features, and there won't be a
2.8, so true division will never be the default in 2.x.


Thanks all for your ansers. I'll import division from __future__
Most of what I'm using in Python is with Sage[1]. Thus I'm not about to 
step to 3.x :(


Laurent

[1] www.sagemath.org
--
http://mail.python.org/mailman/listinfo/python-list


Re: Opportunity missed by Python ?

2011-10-13 Thread Chris Angelico
On Thu, Oct 13, 2011 at 8:45 PM, candide candide@free.invalid wrote:
 Dart is the very new language created by Google to replace Javascript.
 So Python was not able to do the job? Or may be they don't know about Python
 at Google ;) ?


Python, as I found out to my detriment, is practically impossible to
sandbox effectively. Any language that hopes to gain full traction in
a browser-based environment MUST be secure against scripts gaining too
much control over the browser chrome.

Also, Dart is looking to support (optional) strict typing, which
Python doesn't do. That's a fairly major performance enhancement.

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


Re: Embedding a frame into a movie using python

2011-10-13 Thread Chris Angelico
On Thu, Oct 13, 2011 at 7:51 PM, J 1jason.whatf...@gmail.com wrote:
 thank you for your response. I am format agnostic for processing so am happy 
 to work with avi etc., however in displaying the final film to the user I 
 think I'd need to convert whatever I've made to swf to make it a little less 
 downloadable. I'll check out PiTiVi - perhaps I can hack it to work on the 
 back of appengine...

SWF is just as downloadable as any other format. I recommend doing the
fewest translations you can get away with, to avoid unnecessary loss
of quality.

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


Re: Opportunity missed by Python ?

2011-10-13 Thread Terry Reedy

On 10/13/2011 6:07 AM, Chris Angelico wrote:

On Thu, Oct 13, 2011 at 8:45 PM, candidecandide@free.invalid  wrote:

Dart is the very new language created by Google to replace Javascript.
So Python was not able to do the job? Or may be they don't know about Python
at Google ;) ?



Python, as I found out to my detriment, is practically impossible to
sandbox effectively. Any language that hopes to gain full traction in
a browser-based environment MUST be secure against scripts gaining too
much control over the browser chrome.


I believe there was some idea of translating Dart into Javascript, which 
can be done with Python also (Pyjamas).


Also, Dart is looking to support (optional) strict typing, which
Python doesn't do. That's a fairly major performance enhancement.


Cython support optional typing.


--
Terry Jan Reedy

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


Re: Opportunity missed by Python ?

2011-10-13 Thread Chris Rebert
On Thu, Oct 13, 2011 at 3:07 AM, Chris Angelico ros...@gmail.com wrote:
 On Thu, Oct 13, 2011 at 8:45 PM, candide candide@free.invalid wrote:
 Dart is the very new language created by Google to replace Javascript.
 So Python was not able to do the job? Or may be they don't know about Python
 at Google ;) ?


 Python, as I found out to my detriment, is practically impossible to
 sandbox effectively. Any language that hopes to gain full traction in
 a browser-based environment MUST be secure against scripts gaining too
 much control over the browser chrome.

 Also, Dart is looking to support (optional) strict typing, which
 Python doesn't do. That's a fairly major performance enhancement.

Actually, they can't use it as much more than an optimization hint,
per their own spec (see Sec 13.1 of the draft):

Static type annotations are used during static checking and when
running programs in checked mode. They have no effect whatsoever in
production mode.
[...]
A Dart implementation must provide a static checker that detects and
reports exactly those situations this specification identifies as
static warnings. However:
• Running the static checker on a program P is not required for
compiling and running P.
• Running the static checker on a program P must not prevent
successful compilation of P nor may it prevent the execution of P,
regardless of whether any static warnings occur.

Cheers,
Chris
--
http://rebertia.com
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Opportunity missed by Python ?

2011-10-13 Thread Duncan Booth
candide candide@free.invalid wrote:

 Dart is the very new language created by Google to replace Javascript.
 So Python was not able to do the job? Or may be they don't know about 
 Python at Google ;) ?

I take it you haven't actually looked at the Dart tools then? They're 
largely written in Python.

-- 
Duncan Booth http://kupuguy.blogspot.com
-- 
http://mail.python.org/mailman/listinfo/python-list


Dynamically altering __init__

2011-10-13 Thread Kääriäinen Anssi
Hello all,

I am trying to alter the init method of a class by source to AST - alter AST
- AST back to code - f = types.FunctionType(code, {}, '__init__') -
mt = types.MethodType(f, None, Foo) - Foo.__init__ = mt

I have two problems, first I haven't yet figured out how to make the AST back
to code, so that it will be accepted by types.FunctionType. Also, I can't make
the Foo.__init__ be callable with arguments. Here is an example without
using AST:

class Foo(object):
def __init__(self):
 pass

src = 
def my_init_func(self, *args):
print here


class Foo(object):
pass

import parser
import types
st = parser.suite(src)
dyn_func = parser.compilest(st)
f = types.FunctionType(dyn_func, {}, '__init__')
im = types.MethodType(f, None, Foo)
Foo()
Foo.__init__ = im
Foo(1, 2, 3)

The result is: TypeError: module() takes no arguments (4 given). I have
figured out that when I call f(), I am actually executing the src as is, not
the defined function in the src. But I can't figure out how to get a 
reference to my_init_func.

You might be wondering why I am doing this. I am trying to rewrite this:

class Foo(object):
attrs = ['spam', 'eggs']
def __init__(self, *args):
for attname, val in izip(Foo.attrs, args):
setattr(self, attname, val)

into this:
...
def __init__(self, *args):
 self.spam, self.eggs = args

This is done for performance reasons. There is about 2x difference when
creating 1 objects. While it is a nice improvement, this is still mostly
just for learning purposes.

If you can help me it would be great. I am probably doing a lot of things
wrong, but there isn't too much information available about these shorts
of things. Link to example code would be perfect.

 - Anssi Kääriäinen
-- 
http://mail.python.org/mailman/listinfo/python-list


Python gp.ListFeatureClasses return only one file

2011-10-13 Thread yo
Hi All,
I m using the gp.ListFeatureClasses to make a list of file in my
directory (containing several hundreds of file)
however when I print the variable in which the List is supposed to be
stored, the print just return one file name
does any one have an idea

# Import system modules
import sys, string, os, arcgisscripting, glob, arcpy

# Create the Geoprocessor object
gp = arcgisscripting.create()
# define the workspace
gp.Workspace = rF:\front\shp_Files\calving_front
# list the file in the workspace

try:
shpList = gp.ListFeatureClasses(*.shp)
shp = shpList.Next()
print shp

except:
print arcpy.GetMessages() # allows to get error message when they
happen
-- 
http://mail.python.org/mailman/listinfo/python-list


Language Enhancement Idea to help with multi-processing (your opinions please)

2011-10-13 Thread Martin P. Hellwig
First of all let me say that I have no authority or knowledge of 
language design or multi-processing except from a user point of view, 
having a decade or so experience.
I would like your opinion and appreciate any feedback and value any 
hints to documentation, procedures or related ramblings :-).


I was wondering if there could be an advantage to add another control 
flow statement.
For the purpose of this writing let's say ooo which stands for 'out of 
order'.


For example;

def do_something():
a = 4
b = 2
c = 1
ooo:
a += 1
b += 2
c += 3
print(a, b, c)

What I would expect to happen that all statements within the ooo block 
may be executed out
of order. The block itself waits till all statements are returned before 
continuing.


What do you think?
--
http://mail.python.org/mailman/listinfo/python-list


Re: 1/2 evaluates to 0

2011-10-13 Thread SigmundV
On Oct 13, 10:04 am, Laurent Claessens moky.m...@gmail.com wrote:
 Thanks all for your ansers. I'll import division from __future__
 Most of what I'm using in Python is with Sage[1]. Thus I'm not about to
 step to 3.x :(

You should get in touch with the Sage developers. In the Sage FAQ they
say that until SciPy is ported to run with Python 3.x and Cython
supports Python 3.x, Sage will continue to use Python 2.x.

However, both SciPy and Cython are currently compatible with Python
3.2. From the Cython FAQ: As of 0.14, the Cython compiler runs in all
Python versions from 2.3 to 3.2 inclusive. NumPy has supported Python
3 since version 1.5.0. From the release notes: This is the first
NumPy release which is compatible with Python 3. SciPy has supported
Python 3 since version 0.9.0. From the release notes: Scipy 0.9.0 is
the first SciPy release to support Python 3. The only module that is
not yet ported is ``scipy.weave``.

So according to the Sage FAQ there is no reason why Sage shouldn't
support Python 3.


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


Re: Language Enhancement Idea to help with multi-processing (your opinions please)

2011-10-13 Thread Chris Angelico
On Thu, Oct 13, 2011 at 11:35 PM, Martin P. Hellwig
martin.hell...@gmail.com wrote:
 What I would expect to happen that all statements within the ooo block may
 be executed out
 of order. The block itself waits till all statements are returned before
 continuing.


In a statically-typed language such as C, this can be done by an
optimizing compiler, without any hints from the programmer. But in
Python, what you're looking for is either a guarantee from the
programmer that none of the statements has a side effect that affects
any other, or that you're prepared to wear it and have a horrendous
debugging job if anyone monkey-patches your code or you do anything
that makes a, b, or c into something more complex than an integer.

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


Re: Python gp.ListFeatureClasses return only one file

2011-10-13 Thread Andreas Perstinger

On 2011-10-13 14:00, yo wrote:

Hi All,
I m using the gp.ListFeatureClasses to make a list of file in my
directory (containing several hundreds of file)
however when I print the variable in which the List is supposed to be
stored, the print just return one file name
does any one have an idea


Depending on the version you are using, ListFeatureClasses() returns 
either a list or an enumeration object:

http://webhelp.esri.com/arcgisdesktop/9.3/index.cfm?TopicName=ListFeatureClasses_method

You are just printing the first item. To print all, something like the 
following should work (assuming you are using version 9.2):


shpList = gp.ListFeatureClasses(*.shp)
shp = shpList.Next()
while shp:
print shp
shp = shpList.Next()

Bye, Andreas
--
http://mail.python.org/mailman/listinfo/python-list


Re: Opportunity missed by Python ?

2011-10-13 Thread Alain Ketterlin
Chris Angelico ros...@gmail.com writes:

 On Thu, Oct 13, 2011 at 8:45 PM, candide candide@free.invalid wrote:
 Dart is the very new language created by Google to replace Javascript.
 So Python was not able to do the job? Or may be they don't know about Python
 at Google ;) ?

 Python, as I found out to my detriment, is practically impossible to
 sandbox effectively. Any language that hopes to gain full traction in
 a browser-based environment MUST be secure against scripts gaining too
 much control over the browser chrome.

A first step in that direction would be to have a specification for a
python virtual machine.

I guess engineers at Google know very well the limitations of Python in
its current state. After all, python's inventor works there. Also,
they've tried the optimization road with unladden-swallow. And failed.

 Also, Dart is looking to support (optional) strict typing, which
 Python doesn't do. That's a fairly major performance enhancement.

I think you're absolutely right. They've already included a better
DOM. The use of typing will let them provide a very efficient standard
library.

I am willing to bet that Google's next step will be to provide a
plugin/extension/whatever to directly execute Dart programs in the
browsers. And then a JIT compiler inside the VM. And then everybody will
want to move, for performance reason. All the Javascript compatibility
is transitional stuff.

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


Re: Language Enhancement Idea to help with multi-processing (your opinions please)

2011-10-13 Thread Stefan Behnel

Martin P. Hellwig, 13.10.2011 14:35:

I was wondering if there could be an advantage to add another control flow
statement.


Changes at that level must be very well justified, are often rejected for 
the reason of being not too complicated to write in some other form and are 
close to impossible to get accepted when requiring a new keyword.


Also, the right place to discuss (and, more importantly, search for 
previous) ideas about language changes is the python-ideas mailing list.




For the purpose of this writing let's say ooo which stands for 'out of
order'.

For example;

def do_something():
  a = 4
  b = 2
  c = 1
  ooo:
a += 1
b += 2
c += 3
  print(a, b, c)

What I would expect to happen that all statements within the ooo block may
be executed out
of order. The block itself waits till all statements are returned before
continuing.


This looks like a rather special case. What if you need more than one 
statement to accomplish a single step? What if the number of parallel tasks 
is not fixed at coding time? I don't think there are many problems that you 
can solve with this feature.


Also: the GIL will not allow you to take a major advantage from the 
parallel execution of a set of statements, as only one of the statements 
can use the interpreter at a time.


And, on a related note: Cython has freshly gained support for parallel 
loops based on OpenMP, so you may be able to solve your problem with Cython 
instead of using plain Python.


Stefan

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


Re: MySQLdb on Mac Lion

2011-10-13 Thread Tim Johnson
* Ned Deily n...@acm.org [111012 18:12]:
 In article 20111013005244.gk6...@johnsons-web.com,
  Tim Johnson t...@akwebsoft.com wrote:
  I'm most experienced with MySQLdb on ubuntu, which is installed via
  apt-get or synaptic.
  
  I am setting up a mac mini with osX 10.7 (Lion). Macports makes
  py27-mysql 1.2.2 available, but are there any .dmg packages
  available?
 
 I strongly recommend you stick with MacPorts or Homebrew.  There are too 
 many things that can go wrong on OS X 10.6 or 10.7 if you try to install 
 MySQL client libraries, MySQLdb, and Python from different places.  IME, 
 the binary installers for OS X provided by the MySQL are inconsistently 
 built between versions and often need the library paths need to be 
 tweaked.   The only major drawback of using MacPorts is that it will 
 download (and possibly build) its own version of Python but it's a small 
 price to pay: search the archives of Stackoverflow to see how 
 dismayingly often this topic comes up.
  Thanks for that Ned.
-- 
Tim 
tim at tee jay forty nine dot com or akwebsoft dot com
http://www.akwebsoft.com
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Opportunity missed by Python ?

2011-10-13 Thread Westley Martínez
On Thu, Oct 13, 2011 at 11:45:06AM +0200, candide wrote:
 Dart is the very new language created by Google to replace Javascript.
 So Python was not able to do the job? Or may be they don't know
 about Python at Google ;) ?

Google's a big supporter for Python...I think Guido working being
employed there has something to do with it, but I could be conspiring.

Python is not an appropriate language for client-side web scripts, it's
just too good for such a lowly job. ;)
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Opportunity missed by Python ?

2011-10-13 Thread Westley Martínez
On Thu, Oct 13, 2011 at 09:07:09PM +1100, Chris Angelico wrote:
 On Thu, Oct 13, 2011 at 8:45 PM, candide candide@free.invalid wrote:
  Dart is the very new language created by Google to replace Javascript.
  So Python was not able to do the job? Or may be they don't know about Python
  at Google ;) ?
 
 
 Python, as I found out to my detriment, is practically impossible to
 sandbox effectively. Any language that hopes to gain full traction in
 a browser-based environment MUST be secure against scripts gaining too
 much control over the browser chrome.
 
 Also, Dart is looking to support (optional) strict typing, which
 Python doesn't do. That's a fairly major performance enhancement.
 
 ChrisA

You mean static typing?
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Language Enhancement Idea to help with multi-processing (your opinions please)

2011-10-13 Thread jkn
FWIW, this looks rather like the 'PAR' construct of Occam to me.

http://en.wikipedia.org/wiki/Occam_%28programming_language%29

J^n
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: 1/2 evaluates to 0

2011-10-13 Thread Laurent Claessens



You should get in touch with the Sage developers. In the Sage FAQ they
say that until SciPy is ported to run with Python 3.x and Cython
supports Python 3.x, Sage will continue to use Python 2.x.

``scipy.weave``.


So according to the Sage FAQ there is no reason why Sage shouldn't
support Python 3.


Maybe the FAQ is not up to date. Nowadays the reason for not stepping to 
3.x is manpower ;)
(this question comes back two or three times a year on the Sages' list. 
Next time the question arises, I'll point out your remark)


Scipy and Cython are just two of the biggest python parts in Sage, but 
there are many others ... 'till sage itself.


Have a good afternoon
Laurent
--
http://mail.python.org/mailman/listinfo/python-list


Re: Dynamically altering __init__

2011-10-13 Thread Ian Kelly
2011/10/13 Kääriäinen Anssi anssi.kaariai...@thl.fi:
 import parser
 import types
 st = parser.suite(src)
 dyn_func = parser.compilest(st)
 f = types.FunctionType(dyn_func, {}, '__init__')
 im = types.MethodType(f, None, Foo)
 Foo()
 Foo.__init__ = im
 Foo(1, 2, 3)

 The result is: TypeError: module() takes no arguments (4 given). I have
 figured out that when I call f(), I am actually executing the src as is, not
 the defined function in the src. But I can't figure out how to get a
 reference to my_init_func.

You can either pull the function code object out of the module code
object constants:

...
st_code = parser.compilest(st)
func_code = st_code.co_consts[0]
f = types.FunctionType(func_code, {}, '__init__')
...

But you should take care to ensure that the function code object
actually is the first constant.  Or you can just exec your suite and
pull the function from its globals.

src_globals = {}
exec src in src_globals
my_init_func = src_globals['my_init_func']

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


RE: Dynamically altering __init__

2011-10-13 Thread Kääriäinen Anssi
Ian Kelly wrote:

You can either pull the function code object out of the module code
object constants:

...
st_code = parser.compilest(st)
func_code = st_code.co_consts[0]
f = types.FunctionType(func_code, {}, '__init__')
...

But you should take care to ensure that the function code object
actually is the first constant.  Or you can just exec your suite and
pull the function from its globals.

src_globals = {}
exec src in src_globals
my_init_func = src_globals['my_init_func']


Thank you very much. I will post a link to a complete example once
I have done the AST transformations etc. I hope this will be useful to
readers of this list. I didn't find such an example, so maybe the next
asker will find it... And when I inevitably do something the wrong
way in my example, I am sure you will correct me :) 

However, this might take some time before ready, I am new to this
stuff. If there is already an example somewhere, that would be really
helpful to me.

Just a quick note, I tested this on Python2.6, and got around 2.3 seconds
per million objects. With an init doing the setattr loop, I got around 4.7
seconds. So the speed difference is there, but as expected, it isn't that
big. Python3 had similar results.

 - Anssi Kääriäinen
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Language Enhancement Idea to help with multi-processing (your opinions please)

2011-10-13 Thread Martin P. Hellwig

On 13/10/2011 15:13, Stefan Behnel wrote:

Martin P. Hellwig, 13.10.2011 14:35:

I was wondering if there could be an advantage to add another control
flow
statement.


Changes at that level must be very well justified, are often rejected
for the reason of being not too complicated to write in some other form
and are close to impossible to get accepted when requiring a new keyword.

Also, the right place to discuss (and, more importantly, search for
previous) ideas about language changes is the python-ideas mailing list.



For the purpose of this writing let's say ooo which stands for 'out of
order'.

For example;

def do_something():
a = 4
b = 2
c = 1
ooo:
a += 1
b += 2
c += 3
print(a, b, c)

What I would expect to happen that all statements within the ooo block
may
be executed out
of order. The block itself waits till all statements are returned before
continuing.


This looks like a rather special case. What if you need more than one
statement to accomplish a single step?


Aah yes haven't thought about that, was more thinking like wrap multiple 
steps in a function and put that as one line, but yeah that kind of 
stuff gets very unpythonic very quickly.



What if the number of parallel
tasks is not fixed at coding time? I don't think there are many problems
that you can solve with this feature.

Also: the GIL will not allow you to take a major advantage from the
parallel execution of a set of statements, as only one of the statements
can use the interpreter at a time.


Well I was more or less thinking in the line that the interpreter when 
parsing such a statement can, if there are multiple cpu's available, 
fire the appropriate amount of other interpreters and do all the passing 
and locking of data for you.




And, on a related note: Cython has freshly gained support for parallel
loops based on OpenMP, so you may be able to solve your problem with
Cython instead of using plain Python.

Well funny enough I don't really have a problem with it, I am a happy 
consumer of multiprocessing, but I was just wondering if there would be 
a way to do it simpler and more pythonic.



Stefan



Thanks for your feedback it was very enlightening although for what the 
idea is concerned disappointing as it more or less makes it obvious that 
such a thing is a no-go.


Cheers,

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


Re: Opportunity missed by Python ?

2011-10-13 Thread BartC



candide candide@free.invalid wrote in message 
news:4e96b324$0$1007$426a3...@news.free.fr...

Dart is the very new language created by Google to replace Javascript.
So Python was not able to do the job? Or may be they don't know about 
Python at Google ;) ?


The entire resources of Google available, and they re-invent C!

https://code.google.com/p/dart/source/browse/branches/bleeding_edge/dart/client/samples/spirodraw/Spirodraw.dart

--
Bartc 


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


Re: Opportunity missed by Python ?

2011-10-13 Thread Chris Angelico
On Fri, Oct 14, 2011 at 8:38 AM, BartC b...@freeuk.com wrote:
 The entire resources of Google available, and they re-invent C!

Syntactically, C has a lot going for it. If you want to invent a new
language and have developers grok it easily, borrowing syntax from C
will help a lot. But in this case, I think the derivation is from
JavaScript (which itself derives from C), making Dart a more-similar
replacement.

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


Reading a file into a data structure....

2011-10-13 Thread MrPink
This is a continuing to a post I made in August:
http://groups.google.com/group/comp.lang.python/browse_thread/thread/b072cfadf998deae/ce6d4d09911e4107?lnk=gstq=MrPink#ce6d4d09911e4107

I got some free time to work with Python again and have some followup
questions.

For example, I have a list in a text file like this:
Example list of lottery drawings:
date,wb,wb,wb,wb,wb,bb
4/1/2011,5,1,45,23,27,27
5/1/2011,15,23,8,48,22,32
6/1/2011,33,49,21,16,34,1
7/1/2011,9,3,13,22,45,41
8/1/2011,54,1,24,39,35,18


Ticket:
startdate,enddate,wb,wb,wb,wb,wb,bb
4/1/2011,8/1/2011,5,23,32,21,3,27

I am trying to determine the optimal way to organize the data
structure of the drawing list, search the drawing list, and mark the
matches in the drawing list.

f = open(C:\temp\drawinglist.txt, r)
lines = f.readlines()
f.close()
drawing = lines[1].split()

The results in drawing is this:
drawing[0] = '4/1/2011'
drawing[1] = '5'
drawing[2] = '1'
drawing[3] = '45'
drawing[4] = '23'
drawing[5] = '27'
drawing[6] = '27'

I need to convert drawing[0] to a date datatype.  This works, but I'm
sure there is a better way.
from datetime import date
month, day, year = drawing[0].split('/')
drawing[0] = date(int(year), int(month), int(day))

For searching, I need to determine if the date of the drawing is
within the date range of the ticket.  If yes, then mark which numbers
in the drawing match the numbers in the ticket.

ticket[0] = '4/1/2011'
ticket[0] = '8/1/2011'
ticket[0] = '5'
ticket[0] = '23'
ticket[0] = '32'
ticket[0] = '21'
ticket[0] = '3'
ticket[0] = 27'

drawing[0] = '4/1/2011' (match)
drawing[1] = '5' (match)
drawing[2] = '1'
drawing[3] = '45'
drawing[4] = '23' (match)
drawing[5] = '27'
drawing[6] = '27' (match)


I'm debating on structuring the drawing list like this:
drawing[0] = '4/1/2011'
drawing[1][0] = '5'
drawing[1][1] = '1'
drawing[1][2] = '45'
drawing[1][3] = '23'
drawing[1][4] = '27'
drawing[2] = '27'

Sort drawing[1] from low to high
drawing[1][0] = '1'
drawing[1][1] = '5'
drawing[1][2] = '23'
drawing[1][3] = '27'
drawing[1][4] = '45'

I want to keep the drawing list in memory for reuse.

Any guidance would be most helpful and appreciated.
BTW, I want to learn, so be careful not to do too much of the work for
me.
I'm using WingIDE to do my work.

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


Re: Opportunity missed by Python ?

2011-10-13 Thread 88888 dihedral
As long as there are tools to translate scripts or source code between the two 
languages. More new evolved powerful programming  languages arenot problems at 
all for experienced programmers.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Language Enhancement Idea to help with multi-processing (your opinions please)

2011-10-13 Thread Rhodri James

On Thu, 13 Oct 2011 15:33:27 +0100, jkn jkn...@nicorp.f9.co.uk wrote:


FWIW, this looks rather like the 'PAR' construct of Occam to me.

http://en.wikipedia.org/wiki/Occam_%28programming_language%29


I was going to say the same thing.  Occam's answer to Stefan's
question about what to do if you want more than one statement
executed per step was to wrap sequences of statements in a
SEQ construct.  You end up indenting a long way very fast if
you aren't careful.

I'm afraid much as I love PAR, Python's dynamicism makes it
rather more 'exciting' than it was in occam.

--
Rhodri James *-* Wildebeest Herder to the Masses
--
http://mail.python.org/mailman/listinfo/python-list


Re: Language Enhancement Idea to help with multi-processing (your opinions please)

2011-10-13 Thread Neil Hodgson
jkn:

 FWIW, this looks rather like the 'PAR' construct of Occam to me.
 
 http://en.wikipedia.org/wiki/Occam_%28programming_language%29

   Earlier than that, 'par' is from Algol 68:
http://en.wikipedia.org/wiki/ALGOL_68#par:_Parallel_processing

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


Re: Reading a file into a data structure....

2011-10-13 Thread Ian Kelly
On Thu, Oct 13, 2011 at 3:59 PM, MrPink tdsimp...@gmail.com wrote:
 This is a continuing to a post I made in August:
 http://groups.google.com/group/comp.lang.python/browse_thread/thread/b072cfadf998deae/ce6d4d09911e4107?lnk=gstq=MrPink#ce6d4d09911e4107

 I got some free time to work with Python again and have some followup
 questions.

 For example, I have a list in a text file like this:
 Example list of lottery drawings:
 date,wb,wb,wb,wb,wb,bb
 4/1/2011,5,1,45,23,27,27
 5/1/2011,15,23,8,48,22,32
 6/1/2011,33,49,21,16,34,1
 7/1/2011,9,3,13,22,45,41
 8/1/2011,54,1,24,39,35,18
 

 Ticket:
 startdate,enddate,wb,wb,wb,wb,wb,bb
 4/1/2011,8/1/2011,5,23,32,21,3,27

 I am trying to determine the optimal way to organize the data
 structure of the drawing list, search the drawing list, and mark the
 matches in the drawing list.

 f = open(C:\temp\drawinglist.txt, r)
 lines = f.readlines()
 f.close()
 drawing = lines[1].split()

That looks like a CSV file.  If the contents are tightly constrained
then it may not matter, but if not then you should consider using the
csv module to read the lines, which will handle inconvenient details
like quoting and escape characters for you.

 I need to convert drawing[0] to a date datatype.  This works, but I'm
 sure there is a better way.
 from datetime import date
 month, day, year = drawing[0].split('/')
 drawing[0] = date(int(year), int(month), int(day))

If you already know the format:

from datetime import datetime
drawing[0] = datetime.strptime(drawing[0], '%m/%d/%Y').date()

If you can't be sure of the format, then I recommend using the
python-dateutil parser.parse() function, which will try to work it out
on the fly.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Reading a file into a data structure....

2011-10-13 Thread Jon Clements
On Oct 13, 10:59 pm, MrPink tdsimp...@gmail.com wrote:
 This is a continuing to a post I made in 
 August:http://groups.google.com/group/comp.lang.python/browse_thread/thread/...

 I got some free time to work with Python again and have some followup
 questions.

 For example, I have a list in a text file like this:
 Example list of lottery drawings:
 date,wb,wb,wb,wb,wb,bb
 4/1/2011,5,1,45,23,27,27
 5/1/2011,15,23,8,48,22,32
 6/1/2011,33,49,21,16,34,1
 7/1/2011,9,3,13,22,45,41
 8/1/2011,54,1,24,39,35,18
 

 Ticket:
 startdate,enddate,wb,wb,wb,wb,wb,bb
 4/1/2011,8/1/2011,5,23,32,21,3,27

 I am trying to determine the optimal way to organize the data
 structure of the drawing list, search the drawing list, and mark the
 matches in the drawing list.

 f = open(C:\temp\drawinglist.txt, r)
 lines = f.readlines()
 f.close()
 drawing = lines[1].split()

 The results in drawing is this:
 drawing[0] = '4/1/2011'
 drawing[1] = '5'
 drawing[2] = '1'
 drawing[3] = '45'
 drawing[4] = '23'
 drawing[5] = '27'
 drawing[6] = '27'

 I need to convert drawing[0] to a date datatype.  This works, but I'm
 sure there is a better way.
 from datetime import date
 month, day, year = drawing[0].split('/')
 drawing[0] = date(int(year), int(month), int(day))

 For searching, I need to determine if the date of the drawing is
 within the date range of the ticket.  If yes, then mark which numbers
 in the drawing match the numbers in the ticket.

 ticket[0] = '4/1/2011'
 ticket[0] = '8/1/2011'
 ticket[0] = '5'
 ticket[0] = '23'
 ticket[0] = '32'
 ticket[0] = '21'
 ticket[0] = '3'
 ticket[0] = 27'

 drawing[0] = '4/1/2011' (match)
 drawing[1] = '5' (match)
 drawing[2] = '1'
 drawing[3] = '45'
 drawing[4] = '23' (match)
 drawing[5] = '27'
 drawing[6] = '27' (match)

 I'm debating on structuring the drawing list like this:
 drawing[0] = '4/1/2011'
 drawing[1][0] = '5'
 drawing[1][1] = '1'
 drawing[1][2] = '45'
 drawing[1][3] = '23'
 drawing[1][4] = '27'
 drawing[2] = '27'

 Sort drawing[1] from low to high
 drawing[1][0] = '1'
 drawing[1][1] = '5'
 drawing[1][2] = '23'
 drawing[1][3] = '27'
 drawing[1][4] = '45'

 I want to keep the drawing list in memory for reuse.

 Any guidance would be most helpful and appreciated.
 BTW, I want to learn, so be careful not to do too much of the work for
 me.
 I'm using WingIDE to do my work.

 Thanks,

- Use the csv module to read the file
- Use strptime to process the date field
- Use a set for draw numbers (you'd have to do pure equality on the
bb)
- Look at persisting in a sqlite3 DB (maybe with a custom convertor)

hth,

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


Re: [Python-ideas] Implement comparison operators for range objects

2011-10-13 Thread 88888 dihedral
How about iterable objects supported in python?  Is a countable  object 
iterable definitely? Also the tail recursion technique is useful for the same 
function with few arguments that calls itself. The lisp compiler would emit 
machine codes with   fast jumps and passing arguments in registers or stacks 
very efficiently.  
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Language Enhancement Idea to help with multi-processing (your opinions please)

2011-10-13 Thread Steven D'Aprano
Martin P. Hellwig wrote:

 I was wondering if there could be an advantage to add another control
 flow statement.
 For the purpose of this writing let's say ooo which stands for 'out of
 order'.
[...]
 What I would expect to happen that all statements within the ooo block
 may be executed out
 of order. The block itself waits till all statements are returned before
 continuing.

Why do you think this needs to be a language statement?

You can have that functionality *right now*, without waiting for a syntax
update, by use of the multiprocessing module, or a third party module.

http://docs.python.org/library/multiprocessing.html
http://wiki.python.org/moin/ParallelProcessing

There's no need for forcing language changes on everyone, whether they need
it or not, for features that can easily be implemented as library code.



-- 
Steven

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


Looking for browser emulator

2011-10-13 Thread Roy Smith
I've got to write some tests in python which simulate getting a page of 
HTML from an http server, finding a link, clicking on it, and then 
examining the HTML on the next page to make sure it has certain features.

I can use urllib to do the basic fetching, and lxml gives me the tools 
to find the link I want and extract its href attribute.  What's missing 
is dealing with turning the href into an absolute URL that I can give to 
urlopen().  Browsers implement all sorts of stateful logic such as if 
the URL has no hostname, use the same hostname as the current page.  
I'm talking about something where I can execute this sequence of calls:

urlopen(http://foo.com:/bar;)
urlopen(/baz)

and have the second one know that it needs to get 
http://foo.com:/baz;.  Does anything like that exist?

I'm really trying to stay away from Selenium and go strictly with 
something I can run under unittest.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Looking for browser emulator

2011-10-13 Thread Jon Clements
On Oct 14, 3:19 am, Roy Smith r...@panix.com wrote:
 I've got to write some tests in python which simulate getting a page of
 HTML from an http server, finding a link, clicking on it, and then
 examining the HTML on the next page to make sure it has certain features.

 I can use urllib to do the basic fetching, and lxml gives me the tools
 to find the link I want and extract its href attribute.  What's missing
 is dealing with turning the href into an absolute URL that I can give to
 urlopen().  Browsers implement all sorts of stateful logic such as if
 the URL has no hostname, use the same hostname as the current page.  
 I'm talking about something where I can execute this sequence of calls:

 urlopen(http://foo.com:/bar;)
 urlopen(/baz)

 and have the second one know that it needs to get
 http://foo.com:/baz;.  Does anything like that exist?

 I'm really trying to stay away from Selenium and go strictly with
 something I can run under unittest.

lxml.html.make_links_absolute() ?
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Looking for browser emulator

2011-10-13 Thread Jon Clements
On Oct 14, 3:19 am, Roy Smith r...@panix.com wrote:
 I've got to write some tests in python which simulate getting a page of
 HTML from an http server, finding a link, clicking on it, and then
 examining the HTML on the next page to make sure it has certain features.

 I can use urllib to do the basic fetching, and lxml gives me the tools
 to find the link I want and extract its href attribute.  What's missing
 is dealing with turning the href into an absolute URL that I can give to
 urlopen().  Browsers implement all sorts of stateful logic such as if
 the URL has no hostname, use the same hostname as the current page.  
 I'm talking about something where I can execute this sequence of calls:

 urlopen(http://foo.com:/bar;)
 urlopen(/baz)

 and have the second one know that it needs to get
 http://foo.com:/baz;.  Does anything like that exist?

 I'm really trying to stay away from Selenium and go strictly with
 something I can run under unittest.

lxml.html.make_links_absolute() ?
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Looking for browser emulator

2011-10-13 Thread Roy Smith
In article 
2323f3d7-42ff-4de5-9006-4741e865f...@a9g2000yqo.googlegroups.com,
 Jon Clements jon...@googlemail.com wrote:

 On Oct 14, 3:19 am, Roy Smith r...@panix.com wrote:
  I've got to write some tests in python which simulate getting a page of
  HTML from an http server, finding a link, clicking on it, and then
  examining the HTML on the next page to make sure it has certain features.
 
  I can use urllib to do the basic fetching, and lxml gives me the tools
  to find the link I want and extract its href attribute.  What's missing
  is dealing with turning the href into an absolute URL that I can give to
  urlopen().  Browsers implement all sorts of stateful logic such as if
  the URL has no hostname, use the same hostname as the current page.  
  I'm talking about something where I can execute this sequence of calls:
 
  urlopen(http://foo.com:/bar;)
  urlopen(/baz)
 
  and have the second one know that it needs to get
  http://foo.com:/baz;.  Does anything like that exist?
 
  I'm really trying to stay away from Selenium and go strictly with
  something I can run under unittest.
 
 lxml.html.make_links_absolute() ?

Interesting.  That might be exactly what I'm looking for.  Thanks!
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Looking for browser emulator

2011-10-13 Thread Miki Tebeka
IIRC mechanize can do that.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Looking for browser emulator

2011-10-13 Thread Gary Herron

On 10/13/2011 07:19 PM, Roy Smith wrote:

I've got to write some tests in python which simulate getting a page of
HTML from an http server, finding a link, clicking on it, and then
examining the HTML on the next page to make sure it has certain features.

I can use urllib to do the basic fetching, and lxml gives me the tools
to find the link I want and extract its href attribute.  What's missing
is dealing with turning the href into an absolute URL that I can give to
urlopen().  Browsers implement all sorts of stateful logic such as if
the URL has no hostname, use the same hostname as the current page.
I'm talking about something where I can execute this sequence of calls:

urlopen(http://foo.com:/bar;)
urlopen(/baz)

and have the second one know that it needs to get
http://foo.com:/baz;.  Does anything like that exist?

I'm really trying to stay away from Selenium and go strictly with
something I can run under unittest.



Try mechanize
  http://wwwsearch.sourceforge.net/mechanize/
billed as
  Stateful programmatic web browsing in Python.


I handles clicking on links, cookies, logging in/out, and filling in of 
forms in the same way as a real browser, but it's all under 
programmatic control from Python.



In Ubuntu, it's the python-mechanize package.
--
http://mail.python.org/mailman/listinfo/python-list


Re: Looking for browser emulator

2011-10-13 Thread Roy Smith
In article mailman.1961.1318564930.27778.python-l...@python.org,
 Gary Herron gher...@islandtraining.com wrote:
 
 Try mechanize
http://wwwsearch.sourceforge.net/mechanize/
 billed as
Stateful programmatic web browsing in Python.

Wow, this is cool, thanks!  It even does cookies!
-- 
http://mail.python.org/mailman/listinfo/python-list


[issue13158] tarfile.TarFile.getmembers misses some entries

2011-10-13 Thread Lars Gustäbel

Changes by Lars Gustäbel l...@gustaebel.de:


--
assignee:  - lars.gustaebel
nosy: +lars.gustaebel
versions: +Python 3.3

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



[issue13158] tarfile.TarFile.getmembers misses some entries

2011-10-13 Thread Sebastien Binet

Sebastien Binet bi...@cern.ch added the comment:

one interesting additional piece of information is that if I un-tar that file 
and re-tar it w/o gzip compression, getmembers gets the right answer.

-s

--

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



[issue13159] _io.FileIO uses a quadratic-time buffer growth algorithm

2011-10-13 Thread Roundup Robot

Roundup Robot devn...@psf.upfronthosting.co.za added the comment:

New changeset d18c80a8c119 by Nadeem Vawda in branch '3.2':
Issue #13159: Replace FileIO's quadratic-time buffer growth algorithm with a 
linear-time one.
http://hg.python.org/cpython/rev/d18c80a8c119

New changeset 4a6709a071d0 by Nadeem Vawda in branch 'default':
Merge #13159: Replace FileIO's quadratic-time buffer growth algorithm with a 
linear-time one.
http://hg.python.org/cpython/rev/4a6709a071d0

--
nosy: +python-dev

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



[issue13159] _io.FileIO uses a quadratic-time buffer growth algorithm

2011-10-13 Thread Roundup Robot

Roundup Robot devn...@psf.upfronthosting.co.za added the comment:

New changeset c1c434e30e06 by Nadeem Vawda in branch '2.7':
Issue #13159: Replace FileIO's quadratic-time buffer growth algorithm with a 
linear-time one.
http://hg.python.org/cpython/rev/c1c434e30e06

--

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



[issue13159] _io.FileIO uses a quadratic-time buffer growth algorithm

2011-10-13 Thread Antoine Pitrou

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

Thank you :)

--

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



[issue13134] speed up finding of one-character strings

2011-10-13 Thread Martin v . Löwis

Martin v. Löwis mar...@v.loewis.de added the comment:

I think the 1 character sizes are overly complex in this patch, and still 
memchr isn't typically used for them. So I suggest to simplify the code and 
restrict it to 1-byte chars only.

--

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



[issue13164] importing rlcompleter module writes a control sequence in stdout

2011-10-13 Thread Valvanuz

New submission from Valvanuz valvanuz.fernan...@gestion.unican.es:

When you import the module rlcompleter in a python script in Centos 6 (x86_64), 
the control sequence \033[?1034h is printed in stdout. The problem is that 
these sequence is not visible by the user and cause a lot of confusion. 

In my case I compared the output of a python script (the integer 6) in bash and 
I got:

 test: 6: integer expression expected

How to reproduce:

 =
 BASH SCRIPT that calls test.py
 =
 id=$(./test.py)
 echo $id|sed -n l
 if test ${id} -eq 0;then
 fi

 =
 test.py
 =
 #!/usr/bin/python
 import rlcompleter
 a=2
 print a


OUTPUT

[valva@wn009 ~]$ bash p.sh 
\033[?1034h2$
p.sh: line 3: test: 2: integer expression expected


This only has happened to me in Centos 6 (python 2.6.5) I've tested in Centos 
5, debian and Ubuntu and it does not happen.

--
messages: 145452
nosy: valva
priority: normal
severity: normal
status: open
title: importing rlcompleter module writes a control sequence in stdout
type: behavior
versions: Python 2.6

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



[issue13159] _io.FileIO uses a quadratic-time buffer growth algorithm

2011-10-13 Thread Nadeem Vawda

Nadeem Vawda nadeem.va...@gmail.com added the comment:

No problem :)

--
assignee:  - nadeem.vawda
resolution:  - fixed
stage: patch review - committed/rejected
status: open - closed

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



[issue13134] speed up finding of one-character strings

2011-10-13 Thread Antoine Pitrou

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

 I think the 1 character sizes are overly complex in this patch, and
 still memchr isn't typically used for them. So I suggest to simplify
 the code and restrict it to 1-byte chars only.

I would rather propose to simplify the needle heuristic and only use it
when the lower byte is non-zero. A properly optimized memchr() (as in
the glibc / gcc) is definitely faster than our naïve loop.

--

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



[issue8668] Packaging: add a 'develop' command

2011-10-13 Thread higery

higery shoulderhig...@gmail.com added the comment:

 What’s more practical for you, a review or a patch?

I think a review is better(thanks for your time:) ), because some changes maybe 
needed after I have finished all the issues against the develop command.

--

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



[issue6715] xz compressor support

2011-10-13 Thread Martin v . Löwis

Martin v. Löwis mar...@v.loewis.de added the comment:

I have imported xz-5.0.3 into the externals repository now.

--

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



[issue13163] `port` and `host` are confused in `_get_socket

2011-10-13 Thread Antoine Pitrou

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


--
nosy: +r.david.murray

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



[issue13165] Integrate stringbench in the Tools directory

2011-10-13 Thread Antoine Pitrou

New submission from Antoine Pitrou pit...@free.fr:

The stringbench suite of micro-benchmarks, currently available through SVN at 
http://svn.python.org/projects/sandbox/trunk/stringbench, would probably be a 
reasonable addition to the Tools directory.

--
components: Demos and Tools
keywords: easy
messages: 145457
nosy: haypo, pitrou
priority: normal
severity: normal
stage: needs patch
status: open
title: Integrate stringbench in the Tools directory
type: feature request
versions: Python 3.3

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



[issue13150] Most of Python's startup time is sysconfig

2011-10-13 Thread Éric Araujo

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

 Since #9878 proposes an *alternate* solution to *part* of the
 sysconfig problem, I disagree with 'supersede'.
It’s also an older issue.

 A Python solution would be more useful for other implementations
 if enough of the sysconfig info is not CPython specific.
That’s the point: the info currently parsed at runtime by sysconfig is specific 
to CPython (Makefile and pyconfig.h), so adding a CPython-specific C module was 
thought the way to go.

--

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



[issue13162] Trying to install a binary extension as a resource file causes pysetup to give a traceback

2011-10-13 Thread Éric Araujo

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

This does not look related to installing binary files at all, but rather an 
already known bug: #12386.

--
assignee: tarek - eric.araujo
resolution:  - duplicate
stage:  - committed/rejected
status: open - closed
superseder:  - packaging fails in install_distinfo when writing RESOURCES

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



[issue12386] packaging fails in install_distinfo when writing RESOURCES

2011-10-13 Thread Éric Araujo

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

I started to look at this a few days ago and found out that there are no tests 
at all for writing RESOURCES.  I need to look again at the documentation and 
code and add many tests.

--

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



[issue13151] pysetup3 run bdist_wininst fails

2011-10-13 Thread Éric Araujo

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

Metadata now only uses item access, and the names have changed: 
long_description is description, url is home_page, former description is 
summary, etc. (more in PEP 345).  I don’t have Windows yet, so either we wait 
or we iterate I make a patch - you report failures - I make a patch etc.

--

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



[issue13150] Most of Python's startup time is sysconfig

2011-10-13 Thread Antoine Pitrou

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

  A Python solution would be more useful for other implementations
  if enough of the sysconfig info is not CPython specific.
 That’s the point: the info currently parsed at runtime by sysconfig is
 specific to CPython (Makefile and pyconfig.h), so adding a
 CPython-specific C module was thought the way to go.

A module doesn't have to be written in C to be CPython-specific.

--

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



[issue13166] Implement packaging.database.Distribution.__str__

2011-10-13 Thread Éric Araujo

New submission from Éric Araujo mer...@netwok.org:

In code working with instances of packaging.database.Distribution, it’s 
bothersome to have to use '%r %s' % (dist.name, dist.version) all the time.  It 
is also not good-looking in 2.x, where we get u'name'.  I think it would be 
best to implement a __str__ method on the class and just use %s everywhere, for 
example in pysetup list and pysetup search.  More sophisticated clients that 
want to display projects in a GUI can still access dist.name, dist.version and 
other attributes.

I’ve insisted on using %r for project names and paths to avoid ambiguities with 
trailing spaces and such hard-to-catch things.  For logging output, we have to 
pass pure strings, but for direct console printing we could use ANSI escape 
sequences to display projects’ names in bold for example.

--
assignee: tarek
components: Distutils2
messages: 145463
nosy: alexis, eric.araujo, tarek
priority: normal
severity: normal
status: open
title: Implement packaging.database.Distribution.__str__
versions: 3rd party, Python 3.3

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



[issue13165] Integrate stringbench in the Tools directory

2011-10-13 Thread STINNER Victor

STINNER Victor victor.stin...@haypocalc.com added the comment:

Some ideas to improve stringbench:

 - test different Unicode range (stringbench tests only ASCII currently)
 - test mixing different Unicode range, e.g. ascii+latin1, UCS2.find(ascii), 
UCS2.replace(UCS2, UCS4), ...
 - add options to configure string lengths

Python 3.3 is now a little bit faster for pure ASCII strings. Python 3.2 is 
sometimes a little bit slower with non-BMP characters in narrow mode.

I expect different differents on Python 3.3 if we test different Unicode ranges.

--

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



[issue13167] Add get_metadata to packaging

2011-10-13 Thread Éric Araujo

New submission from Éric Araujo mer...@netwok.org:

The PEP 376 implementation in packaging.database has been called ugly and 
opaque.  When discussing PEP 396 for example (that’s why I’m adding Barry and 
Antoine to nosy, for their feedback), 
get_distribution(name).metadata['Version'] did not seem to agree with everyone. 
 (Note that there are shortcuts for two metadata fields: name and version also 
exist as get_distribution(name).name / .version.)

I’m not sure how we can make it less opaque, unless we force people to read 
documentation: PEP 376 proposes a database of installed distributions; 
packaging.database offers get_distribution, which returns an object with some 
attributes.  I can’t have an outside view on this, so maybe you can explain 
what’s opaque and ugly so that we can try to improve it.

I’ve found in distutils-sig archives from two or three years ago that people 
intended to offer a get_metadata function that would take a distribution name 
(i.e. pyOpenSSL, Babel, flufl.enum) and return a mapping object with the 
metadata read from the installed dist-info/METADATA file.  Does that look 
better to you?

--
assignee: tarek
components: Distutils2
files: d2-get_metadata.diff
keywords: patch
messages: 145465
nosy: alexis, barry, eric.araujo, pitrou, tarek
priority: normal
severity: normal
status: open
title: Add get_metadata to packaging
versions: 3rd party, Python 3.3
Added file: http://bugs.python.org/file23394/d2-get_metadata.diff

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



[issue12344] Add **kwargs to get_reinitialized_command

2011-10-13 Thread Éric Araujo

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

This patch has tests that look sensible and pass.

--
Added file: 
http://bugs.python.org/file23395/d2-get_reinitialized_command-kwargs.diff

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



[issue13134] speed up finding of one-character strings

2011-10-13 Thread Martin v . Löwis

Martin v. Löwis mar...@v.loewis.de added the comment:

 I would rather propose to simplify the needle heuristic and only use it
 when the lower byte is non-zero. A properly optimized memchr() (as in
 the glibc / gcc) is definitely faster than our naïve loop.

That would be fine as well. Not sure if a heuristics would be needed in
this case at all: it's probably uncommon that you search for a single
character whose lower-half is 0 (most likely you are then searching for
the null character, and not, say, LATIN CAPITAL LETTER A WITH DOUBLE
GRAVE).

In any case, I still think that the heuristics (if any) needs to be
explained better, and needs some justification in the first place.

--

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



[issue13168] Python 2.6 having trouble finding modules when invoked via a symlink

2011-10-13 Thread Randy Galbraith

New submission from Randy Galbraith randygalbra...@cvty.com:

Hi Python Developers,

Our install of Python 2.6.4 on AIX 5.3 seems to have problems finding modules
when invoked via a symlink.  A direct path to the binary will work.  One symlink
will work, but another will not.  I created a test harness to demonstrate this
issue and collect (hopefully) useful output.

Regards,
-Randy Galbraith
ps. Thanks for making such a great tool available!

--test script--
#!/bin/sh

ACTUAL_BINARY=/mypath/tool/Python-2.6.4/powerpc-AIX5.3/bin/python
FIRST_SYMLINK=/mypath/tool/bin/python
SECOND_SYMLINK=/mypath/tool/powerpc-AIX5.3/bin/python

set -x
echo
echo Actual binary...
ls -ld $ACTUAL_BINARY

echo
echo First symlink...
ls -ld $FIRST_SYMLINK

echo
echo Second symlink...
ls -ld $SECOND_SYMLINK

echo
echo Run with actual binary is good...
$ACTUAL_BINARY -m py_compile test.py

echo
echo Run with first symlink is bad...
$FIRST_SYMLINK -m py_compile test.py

echo
echo Run with second symlink is good...
$SECOND_SYMLINK  -m py_compile test.py

set +x
echo
echo Analysis...
truss $ACTUAL_BINARY -m py_compile test.py 2truss_binary.log

truss $FIRST_SYMLINK -m py_compile test.py 2truss_symlink1.log

truss $SECOND_SYMLINK  -m py_compile test.py 2truss_symlink2.log

echo
echo runpy is found...
grep runpy truss_binary.log

echo
echo runpy is not found...
grep runpy truss_symlink1.log

echo
echo runpy is found...
grep runpy truss_symlink2.log
--end test script--

--terminal output--
$ ./test_script.sh
+ echo

+ echo Actual binary...
Actual binary...
+ ls -ld /mypath/tool/Python-2.6.4/powerpc-AIX5.3/bin/python
-rwxr-xr-x 2 myuserid mygroup1 9727885 2010-02-25 10:57 
/mypath/tool/Python-2.6.4/powerpc-AIX5.3/bin/python
+ echo

+ echo First symlink...
First symlink...
+ ls -ld /mypath/tool/bin/python
lrwxrwxrwx 1 myuserid mygroup2 44 2010-06-02 17:16 /mypath/tool/bin/python - 
../../Python-2.6.4/powerpc-AIX5.3/bin/python
+ echo

+ echo Second symlink...
Second symlink...
+ ls -ld /mypath/tool/powerpc-AIX5.3/bin/python
lrwxrwxrwx 1 myuserid mygroup2 44 2010-06-02 17:16 
/mypath/tool/powerpc-AIX5.3/bin/python - 
../../Python-2.6.4/powerpc-AIX5.3/bin/python
+ echo

+ echo Run with actual binary is good...
Run with actual binary is good...
+ /mypath/tool/Python-2.6.4/powerpc-AIX5.3/bin/python -m py_compile test.py
+ echo

+ echo Run with first symlink is bad...
Run with first symlink is bad...
+ /mypath/tool/bin/python -m py_compile test.py
Could not import runpy module
+ echo

+ echo Run with second symlink is good...
Run with second symlink is good...
+ /mypath/tool/powerpc-AIX5.3/bin/python -m py_compile test.py

Analysis...

runpy is found...
statx(runpy, 0x2FF21168, 76, 0)   Err#2  ENOENT
open(runpy.so, O_RDONLY)  Err#2  ENOENT
open(runpymodule.so, O_RDONLY)Err#2  ENOENT
open(runpy.py, O_RDONLY)  Err#2  ENOENT
open(runpy.pyc, O_RDONLY) Err#2  ENOENT
statx(/mypath/tool/Python-2.6.4/lib/python2.6/runpy, 0x2FF21168, 76, 0) Err#2 
 ENOENT
open(/mypath/tool/Python-2.6.4/lib/python2.6/runpy.so, O_RDONLY) Err#2  ENOENT
open(/mypath/tool/Python-2.6.4/lib/python2.6/runpymodule.so, O_RDONLY) Err#2  
ENOENT
open(/mypath/tool/Python-2.6.4/lib/python2.6/runpy.py, O_RDONLY) = 3
open(/mypath/tool/Python-2.6.4/lib/python2.6/runpy.pyc, O_RDONLY) = 4

runpy is not found...
statx(runpy, 0x2FF21188, 76, 0)   Err#2  ENOENT
open(runpy.so, O_RDONLY)  Err#2  ENOENT
open(runpymodule.so, O_RDONLY)Err#2  ENOENT
open(runpy.py, O_RDONLY)  Err#2  ENOENT
open(runpy.pyc, O_RDONLY) Err#2  ENOENT
Could not import runpy module

runpy is found...
statx(runpy, 0x2FF21178, 76, 0)   Err#2  ENOENT
open(runpy.so, O_RDONLY)  Err#2  ENOENT
open(runpymodule.so, O_RDONLY)Err#2  ENOENT
open(runpy.py, O_RDONLY)  Err#2  ENOENT
open(runpy.pyc, O_RDONLY) Err#2  ENOENT
statx(/mypath/tool/Python-2.6.4/lib/python2.6/runpy, 0x2FF21178, 76, 0) Err#2 
 ENOENT
open(/mypath/tool/Python-2.6.4/lib/python2.6/runpy.so, O_RDONLY) Err#2  ENOENT
open(/mypath/tool/Python-2.6.4/lib/python2.6/runpymodule.so, O_RDONLY) Err#2  
ENOENT
open(/mypath/tool/Python-2.6.4/lib/python2.6/runpy.py, O_RDONLY) = 3
open(/mypath/tool/Python-2.6.4/lib/python2.6/runpy.pyc, O_RDONLY) = 4

--end terminal output--

--
components: Interpreter Core
messages: 145468
nosy: RandyGalbraith
priority: normal
severity: normal
status: open
title: Python 2.6 having trouble finding modules when invoked via a symlink
type: compile error
versions: Python 2.6

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue13168
___
___
Python-bugs-list mailing list
Unsubscribe: 

[issue13169] Regular expressions with 0 to 65536 repetitions and above makes Python crash

2011-10-13 Thread Maurice de Rooij

New submission from Maurice de Rooij mau...@gmail.com:

Regular expressions with 0 to 65536 repetitions and above makes Python crash 
with a OverflowError: regular expression code size limit exceeded exception.
65535 repetitions do not raise this issue.

Tested and confirmed this with versions 2.7.1 and 3.2.2.

C:\Python27python.exe
Python 2.7.1 (r271:86832, Nov 27 2010, 18:30:46) [MSC v.1500 32 bit (Intel)] on 
win32
Type help, copyright, credits or license for more information.
 import re
 re.search('(?s)\A.{0,65535}test', 'test')
_sre.SRE_Match object at 0x00B4E4B8
 re.search('(?s)\A.{0,65536}test', 'test')
Traceback (most recent call last):
  File stdin, line 1, in module
  File C:\Python27\lib\re.py, line 142, in search
return _compile(pattern, flags).search(string)
  File C:\Python27\lib\re.py, line 243, in _compile
p = sre_compile.compile(pattern, flags)
  File C:\Python27\lib\sre_compile.py, line 523, in compile
groupindex, indexgroup
OverflowError: regular expression code size limit exceeded


C:\Python32python.exe
Python 3.2.2 (default, Sep  4 2011, 09:51:08) [MSC v.1500 32 bit (Intel)] on 
win32
Type help, copyright, credits or license for more information.
 import re
 re.search('(?s)\A.{0,65535}test', 'test')
_sre.SRE_Match object at 0x00A6F250
 re.search('(?s)\A.{0,65536}test', 'test')
Traceback (most recent call last):
  File C:\Python32\lib\functools.py, line 176, in wrapper
result = cache[key]
KeyError: (class 'str', '(?s)\\A.{0,65536}test', 0)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File stdin, line 1, in module
  File C:\Python32\lib\re.py, line 158, in search
return _compile(pattern, flags).search(string)
  File C:\Python32\lib\re.py, line 255, in _compile
return _compile_typed(type(pattern), pattern, flags)
  File C:\Python32\lib\functools.py, line 180, in wrapper
result = user_function(*args, **kwds)
  File C:\Python32\lib\re.py, line 267, in _compile_typed
return sre_compile.compile(pattern, flags)
  File C:\Python32\lib\sre_compile.py, line 514, in compile
groupindex, indexgroup
OverflowError: regular expression code size limit exceeded


--
components: Library (Lib)
messages: 145469
nosy: techmaurice
priority: normal
severity: normal
status: open
title: Regular expressions with 0 to 65536 repetitions and above makes Python 
crash
type: crash
versions: Python 2.7, Python 3.2

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



[issue13169] Regular expressions with 0 to 65536 repetitions and above makes Python crash

2011-10-13 Thread STINNER Victor

Changes by STINNER Victor victor.stin...@haypocalc.com:


--
nosy: +haypo

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



[issue13169] Regular expressions with 0 to 65536 repetitions and above makes Python crash

2011-10-13 Thread Brian Curtin

Brian Curtin br...@python.org added the comment:

I might be missing something, but what's the issue? 65535 is the limit, and 
doing 65536 gives a clear overflow exception (no crash).

--
nosy: +brian.curtin
type: crash - behavior

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



[issue13170] distutils2 test failures

2011-10-13 Thread Éric Araujo

New submission from Éric Araujo mer...@netwok.org:

I get three errors/failures on linux3:

ERROR: test_simple_run 
(distutils2.tests.test_command_install_data.InstallDataTestCase)
--
Traceback (most recent call last):
  File distutils2/tests/test_command_install_data.py, line 76, in 
test_simple_run
cmd.run()
  File distutils2/command/install_data.py, line 50, in run
out = self.copy_file(_file[0], dir_dest)[0]
  File distutils2/command/cmd.py, line 378, in copy_file
copyfile(infile, outfile)
  File distutils2/_backport/shutil.py, line 83, in copyfile
raise Error(`%s` and `%s` are the same file % (src, dst))
Error: `/tmp/user/1013/tmpEl9F8m/tmp91wrrV/foo/inst/three` and 
`/tmp/user/1013/tmpEl9F8m/tmp91wrrV/foo/inst/three` are the same file

==
FAIL: test_config (distutils2.tests.test_config.ConfigTestCase)
--
Traceback (most recent call last):
  File distutils2/tests/test_config.py, line 291, in test_config
self.assertEqual(dist.package_data, {'cheese': 'data/templates/*'})
AssertionError: {u'cheese': [u'data/templates/*']} != {'cheese': 
'data/templates/*'}
- {u'cheese': [u'data/templates/*']}
?  -  --  -

+ {'cheese': 'data/templates/*'}

==
FAIL: test_parse_extensions_in_config 
(distutils2.tests.test_config.ConfigTestCase)
--
Traceback (most recent call last):
  File distutils2/tests/test_config.py, line 341, in 
test_parse_extensions_in_config
self.assertEqual(ext.sources, ['c_src/speed_coconuts.c'])
AssertionError: Lists differ: ['c\x00\x00\x00_\x00\x00\x00s\... != 
['c_src/speed_coconuts.c']

First differing element 0:
c_src/speed_coconuts.c
c_src/speed_coconuts.c

- 
['c\x00\x00\x00_\x00\x00\x00s\x00\x00\x00r\x00\x00\x00c\x00\x00\x00/\x00\x00\x00s\x00\x00\x00p\x00\x00\x00e\x00\x00\x00e\x00\x00\x00d\x00\x00\x00_\x00\x00\x00c\x00\x00\x00o\x00\x00\x00c\x00\x00\x00o\x00\x00\x00n\x00\x00\x00u\x00\x00\x00t\x00\x00\x00s\x00\x00\x00.\x00\x00\x00c\x00\x00\x00']
+ ['c_src/speed_coconuts.c']

The last one looks like a codecs issue.

--
assignee: tarek
components: Distutils2
messages: 145470
nosy: alexis, eric.araujo, tarek
priority: normal
severity: normal
status: open
title: distutils2 test failures
versions: 3rd party

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



[issue13169] Regular expressions with 0 to 65536 repetitions raises OverflowError

2011-10-13 Thread Brian Curtin

Changes by Brian Curtin br...@python.org:


--
title: Regular expressions with 0 to 65536 repetitions and above makes Python 
crash - Regular expressions with 0 to 65536 repetitions raises OverflowError

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



[issue13027] python 2.6.6 interpreter core dumps on modules command from help prompt

2011-10-13 Thread Éric Araujo

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

Unless I’m mistaken, this is another of the duplicate reports for the bug fixed 
by Ned in 2.7 recently.

--
nosy: +eric.araujo, ned.deily

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



[issue13151] pysetup3 run bdist_wininst fails

2011-10-13 Thread Vinay Sajip

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

 I don’t have Windows yet, so either we wait or we iterate I make a patch - 
 you report failures - I make a patch etc.

Actually I'm finding these failures on Ubuntu :-)

Although there are MBCS encoding issues which will also need to be fixed before 
you can build a pure-Python .exe installer on Linux (which is possible with 
distutils, so should work in packaging too), these failures occur before you 
get to that point. That last part can be fixed on Linux by doing (in 
bdist_wininst.create_exe):

try:
cfgdata = cfgdata.encode(mbcs)
except LookupError:
cfgdata = cfgdata.encode(latin-1)

which is at least better than what we have now.

--

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



[issue13169] Regular expressions with 0 to 65536 repetitions raises OverflowError

2011-10-13 Thread Ezio Melotti

Changes by Ezio Melotti ezio.melo...@gmail.com:


--
nosy: +ezio.melotti

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



[issue13146] Writing a pyc file is not atomic

2011-10-13 Thread Antoine Pitrou

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

Ok, here is a new patch using O_EXCL.
Also, since import.c is quite different in 3.2, I'm not sure I will bother 
backporting.

--
versions:  -Python 3.2
Added file: http://bugs.python.org/file23396/importrename3.patch

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



[issue13169] Regular expressions with 0 to 65536 repetitions raises OverflowError

2011-10-13 Thread Matthew Barnett

Matthew Barnett pyt...@mrabarnett.plus.com added the comment:

The quantifiers use 65535 to represent no upper limit, so .{0,65535} is 
equivalent to .*.

For example:

 re.match(.*, x * 10).span()
(0, 10)
 re.match(.{0,65535}, x * 10).span()
(0, 10)

but:

 re.match(.{0,65534}, x * 10).span()
(0, 65534)

--
nosy: +mrabarnett

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



[issue13167] Add get_metadata to packaging

2011-10-13 Thread Barry A. Warsaw

Barry A. Warsaw ba...@python.org added the comment:

On Oct 13, 2011, at 04:01 PM, Éric Araujo wrote:

The PEP 376 implementation in packaging.database has been called ugly and
opaque.  When discussing PEP 396 for example (that’s why I’m adding Barry and
Antoine to nosy, for their feedback),
get_distribution(name).metadata['Version'] did not seem to agree with
everyone.  (Note that there are shortcuts for two metadata fields: name and
version also exist as get_distribution(name).name / .version.)

I don't entirely remember my objections to the API, but I wonder if you
couldn't provide attribute access via properties on .metadata?  Or are there
keys that can't be mapped to identifiers (modulo typical dash-to-underscore
mappings)?

I’m not sure how we can make it less opaque, unless we force people to read
documentation: PEP 376 proposes a database of installed distributions;
packaging.database offers get_distribution, which returns an object with some
attributes.  I can’t have an outside view on this, so maybe you can explain
what’s opaque and ugly so that we can try to improve it.

I’ve found in distutils-sig archives from two or three years ago that people
intended to offer a get_metadata function that would take a distribution name
(i.e. pyOpenSSL, Babel, flufl.enum) and return a mapping object with the
metadata read from the installed dist-info/METADATA file.  Does that look
better to you?

So, that would mean instead of

get_distribution(name).metadata['Version']

you'd use

get_metadata(name)['Version']

?

I'm not sure that's really buys you much.

Maybe we just need to live with the current API for a while before we try to
improve it.

--

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



[issue13171] Bug in tempfile module

2011-10-13 Thread Alexander Steppke

New submission from Alexander Steppke astep...@gmail.com:

The tempfile module shows strange behavior under certain conditions. This might 
lead to data leaking or other problems. 

The test session looks as follows:

Python 2.7.2 (default, Jun 12 2011, 15:08:59) [MSC v.1500 32 bit (Intel)] on 
win32
Type help, copyright, credits or license for more information.
 import tempfile
 tmp = tempfile.TemporaryFile()
 tmp.read()
''
 tmp.write('test')
 tmp.read()
'P\xf6D\x02\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\ [ommitted]'

or similar behavior in text mode: 

Python 2.7.2 (default, Jun 12 2011, 15:08:59) [MSC v.1500 32 bit (Intel)] on 
win32
Type help, copyright, credits or license for more information.
 import tempfile
 tmp = tempfile.TemporaryFile('w+t')
 tmp.read()
''
 tmp.write('test')
 tmp.read()
'\x00\xa5\x8b\x02int or long, hash(a) is used instead.\ni\x10 [ommitted]'
 tmp.seek(0)
 tmp.readline()
'test\x00\xa5\x8b\x02int or long, hash(a) is used instead.\n'

This bug seems to be triggered by calling tmp.read() before tmp.seek(). I am 
running Python 2.7.2 on Windows 7 x64, other people have reproduced the problem 
on Windows XP but not under Linux or Cygwin (see also 
http://stackoverflow.com/questions/7757663/python-tempfile-broken-or-am-i-doing-it-wrong).

Thank you for looking into this.
Alexander

--
components: Library (Lib), Windows
messages: 145477
nosy: Alexander.Steppke
priority: normal
severity: normal
status: open
title: Bug in tempfile module
type: behavior
versions: Python 2.7

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



[issue13172] pysetup run --list-commands fails with a traceback

2011-10-13 Thread Paul Moore

New submission from Paul Moore p.f.mo...@gmail.com:

In a directory with 2 files, setup.cfg and a single C file containing source 
for an extension module. The same happens with a pure-python module. This is on 
Windows.

PS D:\Data\python-sample D:\Data\cpython\PCbuild\python.exe -m packaging.run 
run --list-commands
List of available commands:
  bdist: create a built (binary) distribution
  bdist_dumb: create a dumb built distribution
Traceback (most recent call last):
  File D:\Data\cpython\lib\packaging\util.py, line 652, in resolve_name
ret = getattr(ret, part)
AttributeError: 'module' object has no attribute 'bdist_msi'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File D:\Data\cpython\lib\runpy.py, line 160, in _run_module_as_main
__main__, fname, loader, pkg_name)
  File D:\Data\cpython\lib\runpy.py, line 73, in _run_code
exec(code, run_globals)
  File D:\Data\cpython\lib\packaging\run.py, line 666, in module
sys.exit(main())
  File D:\Data\cpython\lib\packaging\run.py, line 653, in main
return dispatcher()
  File D:\Data\cpython\lib\packaging\run.py, line 642, in __call__
return func(self, self.args)
  File D:\Data\cpython\lib\packaging\run.py, line 91, in wrapper
return f(*args, **kwargs)
  File D:\Data\cpython\lib\packaging\run.py, line 264, in _run
cls = dispatcher.cmdclass.get(cmd) or get_command_class(cmd)
  File D:\Data\cpython\lib\packaging\command\__init__.py, line 61, in 
get_command_class
cls = resolve_name(cls)
  File D:\Data\cpython\lib\packaging\util.py, line 654, in resolve_name
raise ImportError(exc)
ImportError: 'module' object has no attribute 'bdist_msi'

--
assignee: tarek
components: Distutils2
messages: 145478
nosy: alexis, eric.araujo, pmoore, tarek
priority: normal
severity: normal
status: open
title: pysetup run --list-commands fails with a traceback
type: behavior
versions: Python 3.3

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



[issue6210] Exception Chaining missing method for suppressing context

2011-10-13 Thread Ezio Melotti

Changes by Ezio Melotti ezio.melo...@gmail.com:


--
nosy: +ezio.melotti

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



[issue13163] `port` and `host` are confused in `_get_socket

2011-10-13 Thread vterron

vterron quinta...@gmail.com added the comment:

Added a ridiculously simple patch, in case it is going to get fixed in 2.7.

--
keywords: +patch
nosy: +vterron
Added file: http://bugs.python.org/file23397/smtplib.py.diff

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



[issue13171] Bug in tempfile module

2011-10-13 Thread R. David Murray

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

I wonder if it is a bug in Windows?  Have you tried similar experiments with 
regular files?  tempfile is really just about *where* the files are located 
(and what happens when they are closed), not about their fundamental nature as 
OS file objects.  (I could be wrong about that on Windows of course, I'm more 
familiar with Linux.)

--
nosy: +r.david.murray

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



[issue13163] `port` and `host` are confused in `_get_socket

2011-10-13 Thread R. David Murray

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

Well, your patch is a little *too* simple: it doesn't change the function 
prototype to match :)

This is a cosmetic issue rather than a bug, but it would still be nice to fix 
it.  Or maybe a documentation issue in the sense that Python code is (usually) 
self documenting :)

--
priority: normal - low

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



[issue13163] `port` and `host` are confused in `_get_socket

2011-10-13 Thread Ram Rachum

Ram Rachum r...@rachum.com added the comment:

The reason this bug bothered me is because I was debugging a Django app, and in 
the stacktrace's local variables I suddenly saw that `host` was `25`, which 
seemed like a bug to me and wasted me 5 minutes. So it's not a critical bug but 
it wasted my time.

--

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



[issue13027] python 2.6.6 interpreter core dumps on modules command from help prompt

2011-10-13 Thread Ned Deily

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

The recent fixes do not address cases like here where importing a module causes 
a crash in the interpreter process, usually due to some faulty third-party 
extension module.  One way to handle it more gracefully might be to move the 
import scan to a separate interpreter subprocess.

--

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



[issue13163] `port` and `host` are confused in `_get_socket

2011-10-13 Thread Víctor Terrón

Víctor Terrón quinta...@gmail.com added the comment:

It was strange it was *that* easy. My newbie apologies, David. Let me take a 
look at it -- hopefully it will be an adequate first task for a newcomer.

--

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



[issue13173] Default values for string.Template

2011-10-13 Thread Bfontaine

New submission from Bfontaine bati...@yahoo.fr:

This patch allows you to define default values for a string.Template, which is 
useful when you need to use a lot some values, but sometimes other values.

for example:

 from string import Template
 s = Template(${user} made me a ${flavor} cake., default={user:Dennis})
 s.substitute(flavor=vanilla)
'Dennis made me a vanilla cake.'
 s.substitute(user=Ken, flavor=chocolate)
'Ken made me chocolate cake.'

--
components: Library (Lib)
files: string_template_default_values.tar
messages: 145485
nosy: nitupho
priority: normal
severity: normal
status: open
title: Default values for string.Template
type: feature request
versions: Python 3.2
Added file: http://bugs.python.org/file23398/string_template_default_values.tar

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



[issue13174] test_os failures on Fedora 15: listxattr() returns ['security.selinux']

2011-10-13 Thread STINNER Victor

New submission from STINNER Victor victor.stin...@haypocalc.com:

==
FAIL: test_fds (test.test_os.ExtendedAttributeTests)
--
Traceback (most recent call last):
  File /home/haypo/prog/python/default/Lib/test/test_os.py, line 1599, in 
test_fds
self._check_xattrs(getxattr, setxattr, removexattr, listxattr)
  File /home/haypo/prog/python/default/Lib/test/test_os.py, line 1574, in 
_check_xattrs
self._check_xattrs_str(str, *args)
  File /home/haypo/prog/python/default/Lib/test/test_os.py, line 1543, in 
_check_xattrs_str
self.assertEqual(listxattr(fn), [])
AssertionError: Lists differ: ['security.selinux'] != []

First list contains 1 additional elements.
First extra element 0:
security.selinux

- ['security.selinux']
+ []

==
FAIL: test_lpath (test.test_os.ExtendedAttributeTests)
--
Traceback (most recent call last):
  File /home/haypo/prog/python/default/Lib/test/test_os.py, line 1584, in 
test_lpath
os.llistxattr)
  File /home/haypo/prog/python/default/Lib/test/test_os.py, line 1574, in 
_check_xattrs
self._check_xattrs_str(str, *args)
  File /home/haypo/prog/python/default/Lib/test/test_os.py, line 1543, in 
_check_xattrs_str
self.assertEqual(listxattr(fn), [])
AssertionError: Lists differ: ['security.selinux'] != []

First list contains 1 additional elements.
First extra element 0:
security.selinux

- ['security.selinux']
+ []

==
FAIL: test_simple (test.test_os.ExtendedAttributeTests)
--
Traceback (most recent call last):
  File /home/haypo/prog/python/default/Lib/test/test_os.py, line 1580, in 
test_simple
os.listxattr)
  File /home/haypo/prog/python/default/Lib/test/test_os.py, line 1574, in 
_check_xattrs
self._check_xattrs_str(str, *args)
  File /home/haypo/prog/python/default/Lib/test/test_os.py, line 1543, in 
_check_xattrs_str
self.assertEqual(listxattr(fn), [])
AssertionError: Lists differ: ['security.selinux'] != []

First list contains 1 additional elements.
First extra element 0:
security.selinux

- ['security.selinux']
+ []

--
components: Extension Modules, Library (Lib)
messages: 145486
nosy: haypo
priority: normal
severity: normal
status: open
title: test_os failures on Fedora 15: listxattr() returns ['security.selinux']
versions: Python 3.3

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



[issue13174] test_os failures on Fedora 15: listxattr() returns ['security.selinux']

2011-10-13 Thread STINNER Victor

STINNER Victor victor.stin...@haypocalc.com added the comment:

Attached patch fixes test_os failures.

--
keywords: +patch
nosy: +benjamin.peterson
Added file: http://bugs.python.org/file23399/xattr_test.patch

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



[issue13175] packaging uses wrong line endings in RECORD files on Windows

2011-10-13 Thread Paul Moore

New submission from Paul Moore p.f.mo...@gmail.com:

On Windows, packaging seems to create RECORD files with an additional CR at the 
end of the line. (So the line end is CR CR LF). This does not seem to be 
consistent, but it is likely to be because a file is being opened in text mode 
rather than binary.

I am trying to develop a reproducible test case, but am having difficulty at 
the moment. I have opened this bug in any case as a place holder and in case 
someone else can reproduce the issue.

--
assignee: tarek
components: Distutils2
messages: 145488
nosy: alexis, eric.araujo, pmoore, tarek
priority: normal
severity: normal
status: open
title: packaging uses wrong line endings in RECORD files on Windows
type: behavior
versions: Python 3.3

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



[issue11880] add a {dist-info} category to distutils2

2011-10-13 Thread Berker Peksag

Changes by Berker Peksag berker.pek...@gmail.com:


--
nosy: +berkerpeksag

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



[issue13088] Add Py_hexdigits constant: use one unique constant to format a digit to hexadecimal

2011-10-13 Thread Roundup Robot

Roundup Robot devn...@psf.upfronthosting.co.za added the comment:

New changeset d76338eacf7c by Victor Stinner in branch 'default':
Issue #13088: Add shared Py_hexdigits constant to format a number into base 16
http://hg.python.org/cpython/rev/d76338eacf7c

--
nosy: +python-dev

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



[issue10653] test_time test_strptime fails on windows

2011-10-13 Thread Roundup Robot

Roundup Robot devn...@psf.upfronthosting.co.za added the comment:

New changeset e3d9c5e690fc by Victor Stinner in branch '3.2':
Issue #10653: On Windows, use strftime() instead of wcsftime() because
http://hg.python.org/cpython/rev/e3d9c5e690fc

New changeset 79e60977fc04 by Victor Stinner in branch 'default':
(Merge 3.2) Issue #10653: On Windows, use strftime() instead of wcsftime()
http://hg.python.org/cpython/rev/79e60977fc04

--
nosy: +python-dev

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



[issue13029] test_strptime fails on Windows 7 french

2011-10-13 Thread STINNER Victor

STINNER Victor victor.stin...@haypocalc.com added the comment:

Yes, this issue is a duplicate of #10653.

--
resolution:  - duplicate

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



[issue10653] test_time test_strptime fails on windows

2011-10-13 Thread STINNER Victor

STINNER Victor victor.stin...@haypocalc.com added the comment:

It's a bug in the Windows API: I used the workaround suggested by Hirokazu 
Yamamoto. Thanks Hirokazu!

Python 2.7 doesn't use wcsftime() and so it is not affected by this issue.

--
resolution:  - fixed
status: open - closed
versions: +Python 3.3

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



[issue13029] test_strptime fails on Windows 7 french

2011-10-13 Thread STINNER Victor

Changes by STINNER Victor victor.stin...@haypocalc.com:


--
status: open - closed

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



[issue13025] mimetypes should read the rule file using UTF-8, not the locale encoding

2011-10-13 Thread Roundup Robot

Roundup Robot devn...@psf.upfronthosting.co.za added the comment:

New changeset 8d8ab3e04363 by Victor Stinner in branch '3.2':
Issue #13025: mimetypes is now reading MIME types using the UTF-8 encoding,
http://hg.python.org/cpython/rev/8d8ab3e04363

New changeset 2c223d686feb by Victor Stinner in branch 'default':
(Merge 3.2) Issue #13025: mimetypes is now reading MIME types using the UTF-8
http://hg.python.org/cpython/rev/2c223d686feb

--
nosy: +python-dev

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



  1   2   >