[RELEASED] six 1.1

2011-11-23 Thread Benjamin Peterson
I'm pleased to announce the immediate availability of six 1.1.0. six
is a small compatibility library for writing code that works on Python
2 and 3 without modification.

six 1.1 features several incremental improvements over 1.0. The
complete list of changes is:

- Add the int2byte function for converting an int of value less than
256 to a bytes object.

- Add compatibility mappings for iterators over the keys, values, and
items of a dictionary.

- Fix six.MAXSIZE on platforms where sizeof(long) != sizeof(Py_ssize_t).

- Issue #3: Add six.moves mappings for filter, map, and zip.


You can download six on PyPi:
http://pypi.python.org/pypi/six

The documentation is at:
http://packages.python.org/six/

Please report bugs at:
http://bitbucket.org/gutworth/six


Regards,
Benjamin
-- 
http://mail.python.org/mailman/listinfo/python-announce-list

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


Re: Python 2.7.2 on Win7 and IDLE (Try it)

2011-11-23 Thread Anssi Saari
W. eWatson wolftra...@invalid.com writes:

 One thing I think no one has offered is whether their installation of
 2.7.2 has the same IDLE oddity that I've described.  That is, if you
 right-click on a py file, do you see a choice for the IDLE editor?

I don't have 2.7.2, but my Windows (7, 32 bit) machine has 3.2 installed
and also 2.6.6 included in Python(x,y) distribution.

Right clicking on a .py has, under Open with, the choices GNU
Emacsclient (my choice for editing), python.exe and pythonw.exe. No
Idle.

I was able to add idle to the menu it by clicking Choose default
program in the menu and pointing that to idle.bat.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: python shell that saves history of typed in commands that will persist between reboots

2011-11-23 Thread Anssi Saari
goldtech goldt...@worldpost.com writes:

 Using Windows. Is there a python shell that has a history of typed in
 commands?

Is there a shell that doesn't have history then? At least both the
vanilla shell and Idle both have basic history in Windows. IPython for
more fun.
-- 
http://mail.python.org/mailman/listinfo/python-list


import _tclinter error in python 2.7.1 Itanium build

2011-11-23 Thread Wong Wah Meng-R32813
Hello there,

I am in the midst of converting my application code from python 1.5.2 to python 
2.7.1.

In the build of my python 2.7.1 on Itanium 64-bit HP11.3 platform, I noticed my 
Tkinter module was built and linked successfully, that I am able to import the 
module and use it. However, I just found out that my application that utilizes 
Tcl/Tk code, somehow wants to use _tclinter, instead of using _tkinter (In fact 
I have a Tkinter.py file) . The only comment I can see from the author is Have 
Pic use Tclinter instead of Tkinter to allow Pic to start with a valid  X 
Display. That comment was left at the time python 1.5.2 and tcl/tk 8.1 (maybe) 
was used and I am not sure if the same issue is applicable to the current 
version of python and tcl/tk.

However, the question I want to ask is, I build python when tcl/tk files are 
both available, why only tk is detected and built-in with python, not tcl?


$ python
Python 2.7.1 (r271:86832, Oct  6 2011, 11:10:10) [C] on hp-ux11
Type help, copyright, credits or license for more information.
 import Tkinter
 import Tclinter
Traceback (most recent call last):
  File stdin, line 1, in module
  File Tclinter.py, line 5, in module
import _tclinter # If this fails your Python is not configured for Tcl
ImportError: No module named _tclinter
 import _tclinter
Traceback (most recent call last):
  File stdin, line 1, in module
ImportError: No module named _tclinter
 import _tkinter


Regards,
Wah Meng

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


Re: python shell that saves history of typed in commands that will persist between reboots

2011-11-23 Thread Steven D'Aprano
On Wed, 23 Nov 2011 11:23:19 +0200, Anssi Saari wrote:

 goldtech goldt...@worldpost.com writes:
 
 Using Windows. Is there a python shell that has a history of typed in
 commands?
 
 Is there a shell that doesn't have history then? At least both the
 vanilla shell and Idle both have basic history in Windows. IPython for
 more fun.

The default interactive interpreter for Python doesn't have persistent 
history, so if you exit the interpreter and restart it, your commands are 
gone.


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


Re: python shell that saves history of typed in commands that will persist between reboots

2011-11-23 Thread Tim Golden

On 23/11/2011 10:29, Steven D'Aprano wrote:

On Wed, 23 Nov 2011 11:23:19 +0200, Anssi Saari wrote:


goldtechgoldt...@worldpost.com  writes:


Using Windows. Is there a python shell that has a history of typed in
commands?


Is there a shell that doesn't have history then? At least both the
vanilla shell and Idle both have basic history in Windows. IPython for
more fun.


The default interactive interpreter for Python doesn't have persistent
history, so if you exit the interpreter and restart it, your commands are
gone.


Not quite

The interpreter inherits the command shell's history function:
Open a cmd window and then a Python session. Do some stuff.

Ctrl-Z to exit to the surrounding cmd window.
Do some random cmd stuff: dir, cd, etc.

Start a second Python session. up-arrow etc. will bring back
the previous Python session's commands (and not the ones you
entered in the surrounding shell)

Obviously this only applies when an underlying cmd session
persists -- if you simply start Python from Start  Run
twice the command history will not persist between sessions.

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


Choosing a Windows C compiler for use with Cython and 32-bit Python 2.7

2011-11-23 Thread python
Looking for some tips on getting started with Cython development
under Windows. I am using Python 2.7.2.

After reading the Cython documentation [1] it appears that one
has a choice of using either the MinGW or MS Visual C compiler.

1. Are there any issues associated with using the MinGW compiler
and mixing C runtimes? This seems the be the simplest and fastest
way to get started with the tradeoff being the need to distribute
another C runtime (in addition to the MS C runtime required for
the Python interpreter itself)

2. Regarding the MS Visual C compiler - can one use the C
compiler that ships with one of the free Express editions of
Visual Studio or must one purchase a full version of MS Visual
Studio to get the appropriate compiler?

3. Which version (2005, 2008, 2010, ...) of MS Visual Studio is
required to compile Cython libraries compatible with the 32 bit
version of Python 2.7.2?

Thank you,
Malcolm

[1] http://docs.cython.org/src/quickstart/install.html
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: What I do and do not know about installing Python on Win 7 with regard to IDLE.

2011-11-23 Thread Anssi Saari
Dennis Lee Bieber wlfr...@ix.netcom.com writes:

 c:\Python32 Start in, and for Target: Python 3.2.2 (64-bit)

   Which tells me that the TARGET field is garbaged, since THAT is what
 specifies the program (and arguments) that has to be run when the
 shortcut is double-clicked.

Actually, no, it's what I have too. 32-bit Windows 7 here and Python
3.2. The Target for the Idle shortcut is just Python 3.2. It's also
greyed out and uneditable.

So yes, weird. Mine works though and I rarely use Idle, so no
complaints.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Choosing a Windows C compiler for use with Cython and 32-bit Python 2.7

2011-11-23 Thread Christian Heimes
Am 23.11.2011 13:11, schrieb pyt...@bdurham.com:
 Looking for some tips on getting started with Cython development
 under Windows. I am using Python 2.7.2.
 
 After reading the Cython documentation [1] it appears that one
 has a choice of using either the MinGW or MS Visual C compiler.
 
 1. Are there any issues associated with using the MinGW compiler
 and mixing C runtimes? This seems the be the simplest and fastest
 way to get started with the tradeoff being the need to distribute
 another C runtime (in addition to the MS C runtime required for
 the Python interpreter itself)

No, don't worry. MinGW from msys can link against almost any C runtime
library.

 2. Regarding the MS Visual C compiler - can one use the C
 compiler that ships with one of the free Express editions of
 Visual Studio or must one purchase a full version of MS Visual
 Studio to get the appropriate compiler?
 
 3. Which version (2005, 2008, 2010, ...) of MS Visual Studio is
 required to compile Cython libraries compatible with the 32 bit
 version of Python 2.7.2?

I've explained everything in PCbuild/readme.txt in great detail.
Summary: You can use the free VS 2088 Express Edition if you don't need
PGO or AMD64 builds.

Christian

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


Re: Peculiarity of '@' in logging.Formatter

2011-11-23 Thread Vinay Sajip
On Nov 21, 11:17 pm, Charlie Martin chasrmar...@gmail.com wrote:
 This is what seems like an odd bug, but in code I'd
 thing often-enough used it must be the expected behavior
 and I just don't understand.  Please, sirs/mesdames, is
 this a bug?

It may be a bug, but if so, it's in the syslog daemon rather than
logging. Please try again with FileHandlers in place of
SysLogHandlers, and confirm whether the anomaly still occurs.

I could reproduce the problem on a Suse 11.3 machine running Python
2.6, but it doesn't occur on Ubuntu for example:

Nov 23 12:33:09 eta-jaunty [slhtest3:026]:My log message:isn't it
special?
Nov 23 12:33:09 eta-jaunty [slhtest3@026]:My log message:isn't it
special?

I get the same (expected) result on Ubuntu for both Python 2.6 and
2.7.

I noticed that on Suse the syslog daemon is rsyslogd, whereas on
Ubuntu it's plain syslogd. Daemons do differ on how they parse
messages :-(

I ran the script with strace, and logging is writing correctly to the
socket:

socket(PF_FILE, SOCK_DGRAM, 0)  = 3
connect(3, {sa_family=AF_FILE, path=/dev/log}, 10) = 0
socket(PF_FILE, SOCK_DGRAM, 0)  = 4
connect(4, {sa_family=AF_FILE, path=/dev/log}, 10) = 0
gettimeofday({1322052499, 78501}, NULL) = 0
send(3, 14[slhtest:026]:My log message..., 51, 0) = 51
send(4, 14[slhtest@026]:My log message..., 51, 0) = 51
close(4)= 0
close(3)= 0

This is on Suse 11.3, where the formatting anomaly does occur - so it
appears to be down to how rsyslogd does things.

Regards,

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


Re: Writing code to be optimizable

2011-11-23 Thread Roy Smith
In article 
63e78437-c76b-4a9e-9a62-bfea8d078...@v5g2000yqn.googlegroups.com,
 snorble snor...@hotmail.com wrote:

 Is it reasonable to prototype an application in Python that will
 require performance?

Yes.  Several observations:

1) The classic 80/20 rule.  80% of the time is spent running 20% of the 
code.  Sometimes quoted as 90/10.  Why waste time optimizing the 80%?

2) Surprisingly to many people, it's difficult to predict in advance 
which 20% will be the slow parts.  Don't sweat it until the whole thing 
is up and running and you can begin to gather profiling data.

3) Often enough, when you're done writing your program, you'll discover 
that it's fast enough to get value from.  Be happy and move onto the 
next task on your list.

 Are there any recommendations on how to write code in such a way that 
 it can later be optimized or replaced with a module written in C or 
 Cython?

Sure.  Make your code modular and loosely coupled.  Each module or class 
should do one thing, and have narrow, well-defined interfaces.  Limit 
the number of other modules or classes it interacts with directly.  If 
you've done that, it becomes easier to a) identify the slow parts and b) 
plug something better in its place.
-- 
http://mail.python.org/mailman/listinfo/python-list


RE: What replaces log4py under Python 3.2?

2011-11-23 Thread Rob Richardson
Thank you for that link.

Our customers are used to the rotating log file capability of the log4py 
package.  I did not see anything in that link that talks about rotating log 
files (changing file name when the date changes, and saving a limited number of 
old log files).  Is that possible using the stdlib logging package?  Is there 
something else available that will do that, so we don't have to roll our own 
(or, more likely, stick to Python 2.7, for which log4py works)?

Thanks again!

RobR

-Original Message-
From: python-list-bounces+rob.richardson=rad-con@python.org 
[mailto:python-list-bounces+rob.richardson=rad-con@python.org] On Behalf Of 
Irmen de Jong
Sent: Tuesday, November 22, 2011 2:41 PM
To: python-list@python.org
Subject: Re: What replaces log4py under Python 3.2?

On 22-11-11 19:32, Rob Richardson wrote:
 Greetings!

 My company has been using the log4py library for a long time.  A co-worker 
 recently installed Python 3.2, and log4py will no longer compile.  (OK, I 
 know that's the wrong word, but you know what I mean.)  What logging package 
 should be used now?

The logging module from Python's stdlib?
http://docs.python.org/py3k/library/logging.html

Irmen

-Original Message-
From: python-list-bounces+rob.richardson=rad-con@python.org 
[mailto:python-list-bounces+rob.richardson=rad-con@python.org] On Behalf Of 
Irmen de Jong
Sent: Tuesday, November 22, 2011 2:41 PM
To: python-list@python.org
Subject: Re: What replaces log4py under Python 3.2?

On 22-11-11 19:32, Rob Richardson wrote:
 Greetings!

 My company has been using the log4py library for a long time.  A co-worker 
 recently installed Python 3.2, and log4py will no longer compile.  (OK, I 
 know that's the wrong word, but you know what I mean.)  What logging package 
 should be used now?

The logging module from Python's stdlib?
http://docs.python.org/py3k/library/logging.html

Irmen


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


RE: What replaces log4py under Python 3.2?

2011-11-23 Thread Peter Otten
Rob Richardson wrote:

 Our customers are used to the rotating log file capability of the log4py
 package.  I did not see anything in that link that talks about rotating
 log files (changing file name when the date changes, and saving a limited
 number of old log files).  Is that possible using the stdlib logging
 package?  

How about

http://docs.python.org/py3k/library/logging.handlers.html#timedrotatingfilehandler


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


Re: What replaces log4py under Python 3.2?

2011-11-23 Thread Alec Taylor
zing!

On Thu, Nov 24, 2011 at 1:18 AM, Peter Otten __pete...@web.de wrote:
 Rob Richardson wrote:

 Our customers are used to the rotating log file capability of the log4py
 package.  I did not see anything in that link that talks about rotating
 log files (changing file name when the date changes, and saving a limited
 number of old log files).  Is that possible using the stdlib logging
 package?

 How about

 http://docs.python.org/py3k/library/logging.handlers.html#timedrotatingfilehandler


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


Python 2.7.2 on XP

2011-11-23 Thread Alemu Tadesse

Dear All,

I am new to python. I do not know why my python editor (for 2.7.2)
changes everything to just black and white after saving. No color for
say the built in functions for loops defs  they all look the same -
it is annoying for someone coming from another editors that help you
track/easily see your work. I just un installed it to install it again.
I know it is pain to install all the scientific things again. I wish
Python has something like R (R-studio) from which you can install
packages very easily. I just started yesterday and already frustrated
with it. I am sticking to python only because I hear good things about
it and I think it is my problem.

Thank you all

Alemu

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


Re: What I do and do not know about installing Python on Win 7 withregard to IDLE.

2011-11-23 Thread John Gordon
In mailman.2962.1322031180.27778.python-l...@python.org Alemu Tadesse 
atade...@sunedison.com writes:

 scientific package is not working and complaining about not able to
 find/load DLL ... frustrating for the first day in the python world. ANY
 tip ?

Post the exact error message you're getting.  Also post your code, if it's
not too long.

-- 
John Gordon   A is for Amy, who fell down the stairs
gor...@panix.com  B is for Basil, assaulted by bears
-- Edward Gorey, The Gashlycrumb Tinies

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


Re: Python 2.7.2 on XP

2011-11-23 Thread John Gordon
In mailman.2973.1322062878.27778.python-l...@python.org Alemu Tadesse 
atade...@sunedison.com writes:

 I am new to python. I do not know why my python editor (for 2.7.2)
 changes everything to just black and white after saving. No color for

What editor are you using?  There are quite a lot of them.

-- 
John Gordon   A is for Amy, who fell down the stairs
gor...@panix.com  B is for Basil, assaulted by bears
-- Edward Gorey, The Gashlycrumb Tinies

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


String splitting by spaces question

2011-11-23 Thread Massi
Hi everyone,

I have to parse a string and splitting it by spaces. The problem is
that the string can include substrings comprises by quotations which
must mantain the spaces. What I need is to pass from a string like:

This is an 'example string'

to the following vector:

[This, is, an, example string]

Which is the best way to achieve this?
Thanks in advance!
-- 
http://mail.python.org/mailman/listinfo/python-list


RE: String splitting by spaces question

2011-11-23 Thread Alemu Tadesse

Hi Everyone,

Can we use rsplit function on an array or vector of strings ? it works
for one not for vector

Alemu


-Original Message-
From: python-list-bounces+atadesse=sunedison@python.org
[mailto:python-list-bounces+atadesse=sunedison@python.org] On Behalf
Of Massi
Sent: Wednesday, November 23, 2011 10:10 AM
To: python-list@python.org
Subject: String splitting by spaces question

Hi everyone,

I have to parse a string and splitting it by spaces. The problem is
that the string can include substrings comprises by quotations which
must mantain the spaces. What I need is to pass from a string like:

This is an 'example string'

to the following vector:

[This, is, an, example string]

Which is the best way to achieve this?
Thanks in advance!
-- 
http://mail.python.org/mailman/listinfo/python-list
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: What I do and do not know about installing Python on Win 7 with regard to IDLE.

2011-11-23 Thread W. eWatson

On 11/22/2011 10:43 PM, Dennis Lee Bieber wrote:

On Tue, 22 Nov 2011 19:46:01 -0800, W. eWatson
wolftra...@invalid.com  declaimed the following in
gmane.comp.python.general:



Of course, Dennis'
C:\Python26\Lib\site-packages\pythonwin\Pythonwin.exe
wouldn't work either.


If you didn't install an ActiveState packaged version, nor hand
installed the win32 extension package into a Python.org installed
system, you won't have PythonWin.


I did a Win 7 search Pythonwin.exe, and found nothing. However,
sometimes that search fails even when though there is something on the
PC that matches the search.

There is a pythonw.exe under C:\Python32.


And has been mentioned at least three times in the last week --
pythonw.exe is the version of the Python interpreter that is supposed to
be the default application for .pyw files. It is the version that does
NOT open a console window for stdin/stdout (IOWs, it is meant for use by
Python scripts that use a graphical library for all I/O -- Tk, wxPython,
etc.). If you ran a graphical script using the plain python.exe it would
open a console window that would just sit there until the script exited.
Glad to hear you're keeping count. :-) I'll pin it on my wall. Don't use 
graphics.

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


Re: What I do and do not know about installing Python on Win 7 withregard to IDLE.

2011-11-23 Thread W. eWatson

On 11/23/2011 8:08 AM, John Gordon wrote:

Inmailman.2962.1322031180.27778.python-l...@python.org  Alemu 
Tadesseatade...@sunedison.com  writes:


scientific package is not working and complaining about not able to
find/load DLL ... frustrating for the first day in the python world. ANY
tip ?


Post the exact error message you're getting.  Also post your code, if it's
not too long.


And post it in a new thread.
--
http://mail.python.org/mailman/listinfo/python-list


Re: String splitting by spaces question

2011-11-23 Thread Arnaud Delobelle
On 23 November 2011 17:10, Massi massi_...@msn.com wrote:
 Hi everyone,

 I have to parse a string and splitting it by spaces. The problem is
 that the string can include substrings comprises by quotations which
 must mantain the spaces. What I need is to pass from a string like:

 This is an 'example string'

 to the following vector:

You mean list

 [This, is, an, example string]


Here's a way:

 s = This is an 'example string' with 'quotes again'
 [x for i, p in enumerate(s.split(')) for x in ([p] if i%2 else p.split())]
['This', 'is', 'an', 'example string', 'with', 'quotes again']

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


Re: What I do and do not know about installing Python on Win 7 with regard to IDLE.

2011-11-23 Thread W. eWatson
So unless Alan Meyer has further interest in this, it looks like it's at 
an end.


It may be time to move on to c++.

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


Re: String splitting by spaces question

2011-11-23 Thread Nick Dokos
Alemu Tadesse atade...@sunedison.com wrote:

 Can we use rsplit function on an array or vector of strings ? it works
 for one not for vector

 ...
 
 I have to parse a string and splitting it by spaces. The problem is
 that the string can include substrings comprises by quotations which
 must mantain the spaces. What I need is to pass from a string like:
 
 This is an 'example string'
 
 to the following vector:
 
 [This, is, an, example string]
 
 Which is the best way to achieve this?
 Thanks in advance!

You can use a list comprehension:

l2 = [x.rsplit(...) for x in l]

But for the original question, maybe the csv module would be
more useful: you can change delimiters and quotechars to match
your input:

import csv
reader = csv.reader(open(foo.txt, rb), delimiter=' ', quotechar=')
for row in reader:
print row

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


Template class and class design on concrete example xl2csv writer

2011-11-23 Thread Karim

Hello All,

I have the following code and I am quite satisfied with its design BUT I 
have the feeling I can do better.
Basically the, main() execute the program (I did not put the parsing of 
arguments function). I am opening
an Excel document and writing content in a CSV one w/ different format. 
The design is an abstract template
class XLWriter, and derived  'Xl2Csv', 'Xl2Scsv', 'Xl2text' classes to 
write the correct ASCII DOCUMENT to correct format.
The property hook method file_format is implement in these classes and 
return an object of type 'XlCsvFileFormat' or 'XlTabFileFormat'.
It allows to put the right file extension and delimiter. These class are 
derived from standard csv.excel and csv.excel_tab.
At last a Factory class MakeXlWriter has the job to create the correct 
writer.


For now I did not add a strategy pattern which usually goes with the 
Template pattern.


Except from that all better design or others critics will be welcome.


Regards
karim

___

from __future__ import print_function

import sys, os, argparse, csv, xlrd

__all__  = ['main', 'Xl2CsvError', 'XLWriter', 'XlCsvFileFormat', 
'XlTabFileFormat', 'Xl2Csv', 'Xl2Scsv', 'Xl2text', 'MakeXlWriter']



class Xl2CsvError(Exception):
The exception class to manage the internal program errors.
pass

class XlWriter(object):
Abstract template class.
def __init__(self, xlfilename=None, sheets=None):
Initializer.
if self.__class__.__name__ == 'XlWriter':
raise TypeError('Abstract template Class XlWriter could not 
be instanciated directly!')


if not xlfilename:
raise Xl2CsvError('Please provide a non empty file name!')
else:
self._source_name = xlfilename

self._book = xlrd.open_workbook(xlfilename)

if sheets is not None:
if isinstance(sheets[0], int):
self._selected_sheets = 
[self._book.sheet_by_index(sheetnum-1) for sheetnum in sheets]

elif isinstance(sheets[0], str):
try:
self._selected_sheets = 
[self._book.sheet_by_name(sheetname) for sheetname in sheets]

except xlrd.biffh.XLRDError, e:
print('{0} in file document {1}'.format(e, xlfilename))
sys.exit(1)
else:
raise Xl2CsvError('Sheets element type not recognized!')
else:
self._selected_sheets = self._book.sheets()

def write(self):
The file extraction public method.

for sheet in self._selected_sheets:
xlfilename = '{sheet}{ext}'.format(sheet=sheet.name, 
ext='.'+self.file_format.extension.lower())

try:
writer = csv.writer(open(xlfilename, 'wb'), 
delimiter=self.file_format.delimiter)
print(Creating csv file '{file}' for sheet '{sheet}' 
contained in document {src} format(
   sheet=sheet.name, file=xlfilename, 
src=self._source_name), end=' ')

for row in xrange(sheet.nrows):
writer.writerow(sheet.row_values(row))
print('Done.')
except csv.Error, e:
print(e)
return 1

return 0

@property
def file_format(self):
Hook method. Need to implement in derived classes.

Should return an XLAsciiFileFormat object to get file extension 
and inner delimiter.


pass

class XlCsvFileFormat(csv.excel):
Add file extension to the usual properties of Excel-generated 
CSV files.

extension = 'CSV'

class XlTabFileFormat(csv.excel_tab):
Add file extension to the usual properties of Excel-generated 
TAB delimited files.

extension = 'TXT'

class Xl2Csv(XlWriter):
@property
def file_format(self):
Hook factory method
return  XlCsvFileFormat()

class Xl2Scsv(XlWriter):
@property
def file_format(self):
Hook factory method
_format = XlCsvFileFormat()
_format.extension = 'SCSV'
_format.delimiter = ';'
return _format

class Xl2Text(XlWriter):
@property
def file_format(self):
Hook factory method
return  XlTabFileFormat()

class MakeXlWriter(object):
Factory class for XLWriter objects.

@staticmethod
def make(xlfilename=None, sheets=None, extension='CSV'):
if extension == TXT:
   return Xl2Text(xlfilename=xlfilename, sheets=sheets)
elif extension == SCSV:
   return Xl2Scsv(xlfilename=xlfilename, sheets=sheets)
elif extension == CSV:
   return Xl2Csv(xlfilename=xlfilename, sheets=sheets)

def main():
Main of this application
args = _process_command_line()
args.xl.close()
writer = MakeXlWriter.make(xlfilename=args.xl.name, 
sheets=args.sheets, extension=args.ext)

return 

Re: What I do and do not know about installing Python on Win 7 with regard to IDLE.

2011-11-23 Thread Arnaud Delobelle
On 23 November 2011 17:38, W. eWatson wolftra...@invalid.com wrote:
[...]
 It may be time to move on to c++.

Good Luck.  Bye!

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


Re: String splitting by spaces question

2011-11-23 Thread Jerry Hill
On Wed, Nov 23, 2011 at 12:10 PM, Massi massi_...@msn.com wrote:

 Hi everyone,

 I have to parse a string and splitting it by spaces. The problem is
 that the string can include substrings comprises by quotations which
 must mantain the spaces. What I need is to pass from a string like:

 This is an 'example string'

 to the following vector:

 [This, is, an, example string]

 Which is the best way to achieve this?



This sounds a lot like the way a shell parses arguments on the command
line.  If that's your desire, python has a module in the standard library
that will help, called shlex (http://docs.python.org/library/shlex.html).
Particularly, shlex.split may do exactly what you want out of the box:

Python 2.6.4 (r264:75708, Oct 26 2009, 08:23:19) [MSC v.1500 32 bit
(Intel)] on win32

 import shlex
 s = This is an 'example string'
 shlex.split(s)
['This', 'is', 'an', 'example string']


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


Re: Python 2.7.2 on XP

2011-11-23 Thread MRAB

On 23/11/2011 15:40, Alemu Tadesse wrote:

I am new to python. I do not know why my python editor (for 2.7.2)
changes everything to just black and white after saving.


If you're using IDLE, are you saving the file without the .py
extension? That could be the problem.


No color for say the built in functions for loops defs  they all
look the same - it is annoying for someone coming from another
editors that help you track/easily see your work. I just un installed
it to install it again. I know it is pain to install all the
scientific things again. I wish Python has something like R
(R-studio) from which you can install packages very easily. I just
started yesterday and already frustrated with it. I am sticking to
python only because I hear good things about it and I think it is my
problem.


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


RE: Python 2.7.2 on XP

2011-11-23 Thread Alemu Tadesse
I am saving it with .py extention


-Original Message-
From: python-list-bounces+atadesse=sunedison@python.org
[mailto:python-list-bounces+atadesse=sunedison@python.org] On Behalf
Of MRAB
Sent: Wednesday, November 23, 2011 12:01 PM
To: python-list@python.org
Subject: Re: Python 2.7.2 on XP

On 23/11/2011 15:40, Alemu Tadesse wrote:
 I am new to python. I do not know why my python editor (for 2.7.2)
 changes everything to just black and white after saving.

If you're using IDLE, are you saving the file without the .py
extension? That could be the problem.

 No color for say the built in functions for loops defs  they all
 look the same - it is annoying for someone coming from another
 editors that help you track/easily see your work. I just un installed
 it to install it again. I know it is pain to install all the
 scientific things again. I wish Python has something like R
 (R-studio) from which you can install packages very easily. I just
 started yesterday and already frustrated with it. I am sticking to
 python only because I hear good things about it and I think it is my
 problem.

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


Re: Python 2.7.2 on XP

2011-11-23 Thread John Gordon
In mailman.2984.1322074984.27778.python-l...@python.org Alemu Tadesse 
atade...@sunedison.com writes:

 I am saving it with .py extention

It would really help us answer your question if you identified
which editor you're using.  IDLE?  PyScripter?  Eclipse?  PyCharm?

-- 
John Gordon   A is for Amy, who fell down the stairs
gor...@panix.com  B is for Basil, assaulted by bears
-- Edward Gorey, The Gashlycrumb Tinies

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


Re: String splitting by spaces question

2011-11-23 Thread Miki Tebeka
http://docs.python.org/library/shlex.html
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: What I do and do not know about installing Python on Win 7 with regard to IDLE.

2011-11-23 Thread Sibylle Koczian

Am 23.11.2011 04:45, schrieb Alan Meyer:

On 11/22/2011 3:05 PM, Dennis Lee Bieber wrote:

On Tue, 22 Nov 2011 14:29:18 -0500, Alan Meyeramey...@yahoo.com
declaimed the following in gmane.comp.python.general:


On 11/22/2011 1:55 PM, Alan Meyer wrote:
...

6. Select, or navigate to and select, the python IDLE interpreter.

...
On my system that's
C:\Python26\Lib\site-packages\pythonwin\Pythonwin.exe


Note that this is not the Tk based IDLE (which is implemented,
itself, as a .pyw file and is not natively executable -- which seems to
be one of the problems; Win7 has removed the detailed file type
association windows so you can't specify that the application is
pythonw.exe running idle.pyw using one's selected file as the argument
to the mess).


Bummer!

Sorry W.eWatson, my instructions may not work. I've got the ActiveState
Python on my Windows machine. It runs a .exe file as the IDLE
executable. If your implementation doesn't have an exe then you're going
to have to do some more complex work.



PythonWin hasn't got anything to do with IDLE, it's another IDE for 
Python. It is part of the Python for Windows extensions:

http://sourceforge.net/projects/pywin32/.


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


Re: What I do and do not know about installing Python on Win 7 with regard to IDLE.

2011-11-23 Thread Ben Finney
Arnaud Delobelle arno...@gmail.com writes:

 On 23 November 2011 17:38, W. eWatson wolftra...@invalid.com wrote:
 [...]
  It may be time to move on to c++.

 Good Luck.  Bye!

Sadly, IME it's most often the case that the person who threatens to
leave with just about every message will instead stick around a long
time, repeating the same threats while expecting those threats to elicit
support.

-- 
 \ “It is far better to grasp the universe as it really is than to |
  `\persist in delusion, however satisfying and reassuring.” —Carl |
_o__)Sagan |
Ben Finney
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: What I do and do not know about installing Python on Win 7 with regard to IDLE.

2011-11-23 Thread Alan Meyer

On 11/23/2011 12:38 PM, W. eWatson wrote:

So unless Alan Meyer has further interest in this, it looks like it's at
an end.

It may be time to move on to c++.



C++ is a ton of fun.  You haven't lived until you've made a syntax error 
in a template instantiation and seen a hundred cascading error messages 
from included files that you didn't know you included.


Unlike Python, it really builds character.

I say, go for it!

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


Re: What I do and do not know about installing Python on Win 7 with regard to IDLE.

2011-11-23 Thread Matt Joiner
Moving to C++ is _always_ a step backwards.

On Thu, Nov 24, 2011 at 9:29 AM, Alan Meyer amey...@yahoo.com wrote:
 On 11/23/2011 12:38 PM, W. eWatson wrote:

 So unless Alan Meyer has further interest in this, it looks like it's at
 an end.

 It may be time to move on to c++.


 C++ is a ton of fun.  You haven't lived until you've made a syntax error in
 a template instantiation and seen a hundred cascading error messages from
 included files that you didn't know you included.

 Unlike Python, it really builds character.

 I say, go for it!

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

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


Running Idle on Windows 7

2011-11-23 Thread Phil Rist
I have installed ActiveState Python 32bit on my computer.  There 
are potentially five different ways that Idle can be run.  Actually six
if you include activating a command window and typing in the command.
We will not do that here.

The first way is to use the shortcut put into the start menu by the
ActiveState installation program.  Left click on the start menu icon
followed by hovering over the 'All Programs' button will bring up the 
menu.  At this point find and click the ActiveState ActivePython entry.
This will bring up the Python sub-menu on which Idle can be found and
clicked to start Idle.  If this is not previously you could create a shortcut as
described below and move it to the start button.  I do not know how to do that
on Windows 7.

The other methods may require some effort on your part.  Each extension
has a file type.  Each file type has a context menu which can be accessed
by right clicking an appropriate Windows Explorer entry or desktop icon.
The contents of the context menu is maintained in the registry.  The Regedit
utility can be used to modify the menu.

The following text typed into a file with a .reg extension can be used to
create part of a context menu for files with either a .py or .pyw extension.
Once the file is created it can be run by double clicking the file's
entry in Windows Explorer.  The file type I selected is pyfile.  If you select
a file type that already exists it will be overwritten.  If these extensions
have already been given a file type that file type should be used.  If there is 
already an Open command and you do not want to replace it change the Open names
here to something that is not already used.Note the wrapping of the last
line.


REGEDIT4

[HKEY_CLASSES_ROOT\.py]
@=pyfile

[HKEY_CLASSES_ROOT\.pyw]
@=pyfile

[HKEY_CLASSES_ROOT\pyfile]
@=Python source

[HKEY_CLASSES_ROOT\pyfile\Shell]
@=Open

[HKEY_CLASSES_ROOT\pyfile\Shell\Open]
@=Open
EditFlags=hex:01,00,00,00
[HKEY_CLASSES_ROOT\pyfile\Shell\Open\Command]
@=c:\\sys\\Language\\python\\pythonw.exe 
C:\\Sys\\Language\\Python\\Lib\\idlelib\\idle.pyw \%1\   

The first two group of lines simply assign the pyfile file type to the two
extensions.  The third group sets the file type description displayed by 
Windows Explorer to 'Python Source'.  The fourth group  makes Open the default 
command.  The command that will be executed when a file is doubled clicked.  
The last group defines the text for the command.  This is basically the same as 
any command entered in a command window except instead of a file name %1 is 
entered.  This will be replaced by the name of the selected python file.  Also
any
'\' or '' which appear in the command must be preceeded by a '\'.  The command 
given here will run Idle.  The file paths will need to be changed to what is 
appropriate on your computer.

I noticed that I had a file type Python.File.  This file type had two commands
one to run the program, 'Open' and one to Edit with Pythonwin, 
'Edit with Pythonwin'.  This was setup by the ActiveState installation program. 
These can be recovered with a .reg file with the following contents.

REGEDIT4

[HKEY_CLASSES_ROOT\.py]
@=Python.File

[HKEY_CLASSES_ROOT\.pyw]
@=Python.File


There is also a context menu for directories.  One menu for all directories.  
An entry for Idle can be created with the following code.  This also is
entered into a .reg file.  The same rules apply.  Here %1 will be replaced 
by the directory path.  Like the Start Menu method you do not have access 
to a file path.  Note the wrapping of the last line.

REGEDIT4

[HKEY_CLASSES_ROOT\Directory\Shell\Idle]
@=Idle
EditFlags=hex:01,00,00,00
[HKEY_CLASSES_ROOT\Directory\Shell\Idle\Command]
@=c:\\sys\\Language\\python\\pythonw.exe 
C:\\Sys\\Language\\Python\\Lib\\idlelib\\idle.pyw   


The fourth way is to create a shortcut to Idle.  This is basically the same 
as the Start Menu method except the shortcut can be put on the desktop where
it will appear as an icon or in any directory where it can be accessed from
Windows Explorer.  My technique here was to create a directory called 'Python'.
Within that directory I created three directories 'New', 'Explore' and
'Projects'
to contain my Python programs.  The 'Python' directory contains  infrastructure
files such as the .reg files.

I created a fourth sub-menu called 'Python Shortcuts'.  I added several
shortcuts which I thought would be useful, including a shortcut to Idle. 
Windows allows me to create a toolbar on the quick launch bar.  This toolbar
contains a list of the contents of a selected directory.  In my case the 'Python
Shortcuts' directory. I can run Idle by clicking on the toolbar and then the
entry for Idle.

To create the shortcut find the Python interpreter pythonw.exe.  Right click it
and select 'Create shortcut'.  The shortcut will appear in the same directory as
pythonw.exe.  Drag it to the directory you want it in.  

Re: String splitting by spaces question

2011-11-23 Thread Phil Rist
In article 3f19e4c0-e010-4cb2-9f71-dd09e0d3c...@r9g2000vbw.googlegroups.com,
Massi says...

Hi everyone,

I have to parse a string and splitting it by spaces. The problem is
that the string can include substrings comprises by quotations which
must mantain the spaces. What I need is to pass from a string like:

This is an 'example string'

to the following vector:

[This, is, an, example string]

Which is the best way to achieve this?
Thanks in advance!


Is this what you want?

import shlex


lText = This is a 'short string' for you to read.
lWords = shlex.split(lText)
print lWords

produces,

['This', 'is', 'a', 'short string', 'for', 'you', 'to', 'read.']

Shlex can be found under 'Program Frameworks' under 'The Python Standard
Library' of ActivePython 2.7 documentation.

C:\Source\Python\New

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


Re: python shell that saves history of typed in commands that will persist between reboots

2011-11-23 Thread Steven D'Aprano
On Wed, 23 Nov 2011 10:37:56 +, Tim Golden wrote:

 The interpreter inherits the command shell's history function: Open a
 cmd window and then a Python session. Do some stuff.
 
 Ctrl-Z to exit to the surrounding cmd window. Do some random cmd stuff:
 dir, cd, etc.
 
 Start a second Python session. up-arrow etc. will bring back the
 previous Python session's commands (and not the ones you entered in the
 surrounding shell)

Doesn't work for me, at least not with Python 2.5 and 2.6 on Linux.

I don't suppose you are running a site-specific command history script in 
your startup.py file?


[steve@wow-wow ~]$ unset PYTHONSTARTUP
[steve@wow-wow ~]$ python
Python 2.5 (r25:51908, Nov  6 2007, 16:54:01)
[GCC 4.1.2 20070925 (Red Hat 4.1.2-27)] on linux2
Type help, copyright, credits or license for more information.
 print 42
42

[1]+  Stopped python
[steve@wow-wow ~]$ python
Python 2.5 (r25:51908, Nov  6 2007, 16:54:01)
[GCC 4.1.2 20070925 (Red Hat 4.1.2-27)] on linux2
Type help, copyright, credits or license for more information.



You can't see it, but I'm hitting the up arrow on that last line, and 
nothing is happening except my console is flashing :)


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


Re: Is there any way to unimport a library

2011-11-23 Thread DevPlayer
Seems so far the common way to fully unload any import is to exit the
Python session.
Only if this is true do I offer this hackish idea:

Therefore you might wish to run an os script instead of a python
script right off.
Here is my hack at it... Something like this:

file myapp.bat
--
python get_availble_imports.py available_imports.log
python myapp.py available_imports.log


file get_availble_imports.py

find_module_names = 
os sys time
sqlite lib1_verA lib2_verA
sqlite3 lib1_verB lib2_verB


# other code i'm leaving out of this forum post

def find_module_names_using_pydoc( block_string ):

'''Searchs for module names, provided in a block string,
against the resultant module names list returned from pydoc. \n
Returns a list of strings, being the intersection of module names
from both lists.'''

all_wanted_modules = parse_block_for_module_names( block_string )
# use split and drop empties

module_names_found = []

# walk_packages actually imports libraries;
# so you know the import should work.
# i call em modules; but they could be packages too

# following line can take many seconds to run
package_generator = pydoc.pkgutil.walk_packages(path=None,
prefix='', onerror=error_handler)

for package_name in package_generator:
module_loader, module_name, ispkg = package_name
if module_name in all_wanted_modules:
module_names_found.append( module_name )
print repr( module_name )

return module_names_found

found = find_module_names_using_pydoc( find_module_names )

#Then with a switch statement (if/elif) create a string with to be
#saved to the log file with what module names are in usable_mods

if 'sqlite' in found and 'lib1_verA' in found and 'lib2_verA' in
found:
save('import sqlite, lib1_verA, lib2_verA')
elif 'sqlite' in found and 'lib1_verB' in found and 'lib2_verB' in
found:
save('import sqlite3, lib1_verB, lib2_verB')
else:
raise ImportError('Necessary packages not found')


file myapp.py
-
with open('available_imports.log','r') as f:
text = f.read()
exec(text)
# DONE
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Is there any way to unimport a library

2011-11-23 Thread DevPlayer
btw if you like processing text outside of python (say using grep or
something)

python -c help('modules')  all_imports.log

which you might note on windows get's processed to:
python -c help('modules') 1 all_imports.log
on windows from within a batch file

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


Capturing SIGSTOP

2011-11-23 Thread Steven D'Aprano
I'd like to perform a task when the user interrupts my application with 
Ctrl-Z on Linux. I tried installing a signal handler:


import signal

def handler(signalnum, stackframe):
print Received signal %d % signalnum

signal.signal(signal.SIGSTOP, handler)

But I got a RuntimeError:

Traceback (most recent call last):
  File stdin, line 1, in module
RuntimeError: (22, 'Invalid argument')


This isn't documented:

http://docs.python.org/library/signal.html#signal.signal


Is there a way to catch SIGSTOP?



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


Bind key press to call function

2011-11-23 Thread Steven D'Aprano
I'm looking for a way to interrupt a long-running function on a key 
press, but without halting the function.

E.g. if I have these two functions:

def handler(*args):
print caught interrupt and continuing...


def exercise_cpu():
for i in range(8):
print working...
for j in range(100):
pass
print done


and I call exercise_cpu(), then type some key combination (say, Ctrl-x-p 
for the sake of the argument), I'd like the result to look something like 
this:

 exercise_cpu()
working...
working...
working...
working...
working...
working...
caught interrupt and continuing...
working...
working...
done


I think I want to use the readline module to catch the key press Ctrl-x-p 
and generate a signal, say SIGUSR1, then use the signal module to install 
a signal handler to catch SIGUSR1. Is this the right approach, or is 
there a better one? Does anyone show me an example of working code that 
does this?

Linux only solutions are acceptable.


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


Re: String splitting by spaces question

2011-11-23 Thread DevPlayer
This is an 'example string'

Don't for get to watch for things like:

Don't, Can't, Won't, I'll, He'll, Hor'davors, Mc'Kinly
-- 
http://mail.python.org/mailman/listinfo/python-list


Tree data structure with: single, double and triple children option along with AVM data at each node

2011-11-23 Thread nirman longjam
Dear sir,

I am very happy to find this group.

Sir, i am new to Python. Currently i am working on text processing.
Can you give me some suggestions about Tree data structure
representation, where i require each node capable to handle:  only one
child, or up to 3 children plus hold feature information.


Thanking you,
L. Nirman Singh

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


Re: Bind key press to call function

2011-11-23 Thread Chris Angelico
On Thu, Nov 24, 2011 at 2:55 PM, Steven D'Aprano
steve+comp.lang.pyt...@pearwood.info wrote:
 I'm looking for a way to interrupt a long-running function on a key
 press, but without halting the function.

I assume there's a reason for not using Ctrl-C and SIGINT with the
signal module?

This looks like the classic sigint handler sets a flag that the main
loop polls structure.

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


Re: Capturing SIGSTOP

2011-11-23 Thread Chris Angelico
On Thu, Nov 24, 2011 at 2:29 PM, Steven D'Aprano
steve+comp.lang.pyt...@pearwood.info wrote:
 Is there a way to catch SIGSTOP?

In the strictest sense, no; SIGSTOP can't be caught. However, some
systems have SIGTSTP which is sent when you hit Ctrl-Z, which would be
what you're looking for.

http://www.gnu.org/s/hello/manual/libc/Job-Control-Signals.html

Tested on my Linux box only; this almost certainly won't work on Windows.

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


Re: python shell that saves history of typed in commands that will persist between reboots

2011-11-23 Thread Chris Angelico
On Thu, Nov 24, 2011 at 1:16 PM, Steven D'Aprano
steve+comp.lang.pyt...@pearwood.info wrote:
 On Wed, 23 Nov 2011 10:37:56 +, Tim Golden wrote:

 The interpreter inherits the command shell's history function: Open a
 cmd window and then a Python session. Do some stuff.

 Ctrl-Z to exit to the surrounding cmd window. Do some random cmd stuff:
 dir, cd, etc.

 [1]+  Stopped                 python

Ctrl-Z is the Windows equivalent (well, mostly) of Linux's Ctrl-D. You
want to cleanly exit the interpreter, not SIGSTOP it.

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


RE: Thread problem

2011-11-23 Thread Nikunj.Badjatya
Can someone help me on this please?


From: python-list-bounces+nikunj.badjatya=emc@python.org 
[mailto:python-list-bounces+nikunj.badjatya=emc@python.org] On Behalf Of 
nikunj.badja...@emc.com
Sent: Wednesday, November 23, 2011 11:15 AM
To: python-list@python.org
Subject: Thread problem

Howdy All,

Please see http://pastebin.com/GuwH8B5C .
Its a sample program implementing progressbar in multithreaded program.
Here I am creating a thread and passing update2() function to it.

Now wheneever I press CTRL-C, the program isnt returning to prompt. !

Can someone help me out with this please. !

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


Re: Bind key press to call function

2011-11-23 Thread Steven D'Aprano
On Thu, 24 Nov 2011 15:20:09 +1100, Chris Angelico wrote:

 On Thu, Nov 24, 2011 at 2:55 PM, Steven D'Aprano
 steve+comp.lang.pyt...@pearwood.info wrote:
 I'm looking for a way to interrupt a long-running function on a key
 press, but without halting the function.
 
 I assume there's a reason for not using Ctrl-C and SIGINT with the
 signal module?

Yes, I want to leave Ctrl-C alone and have a similar, but separate, 
signal handler (or equivalent).

 This looks like the classic sigint handler sets a flag that the main
 loop polls structure.

Exactly. I am open to alternative methods if they are lightweight. 



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


Re: python shell that saves history of typed in commands that will persist between reboots

2011-11-23 Thread Steven D'Aprano
On Thu, 24 Nov 2011 15:30:57 +1100, Chris Angelico wrote:

 On Thu, Nov 24, 2011 at 1:16 PM, Steven D'Aprano
 steve+comp.lang.pyt...@pearwood.info wrote:
 On Wed, 23 Nov 2011 10:37:56 +, Tim Golden wrote:

 The interpreter inherits the command shell's history function: Open a
 cmd window and then a Python session. Do some stuff.

 Ctrl-Z to exit to the surrounding cmd window. Do some random cmd
 stuff: dir, cd, etc.

 [1]+  Stopped                 python
 
 Ctrl-Z is the Windows equivalent (well, mostly) of Linux's Ctrl-D. You
 want to cleanly exit the interpreter, not SIGSTOP it.


One of us is confused, and I'm pretty sure it's you :)

Tim went on to say Obviously this only applies when an underlying cmd 
session persists, which I understood as implying that he too is using 
Linux where Ctrl-Z stops the process, but does not exit it.



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


Re: Bind key press to call function

2011-11-23 Thread Chris Angelico
On Thu, Nov 24, 2011 at 5:07 PM, Steven D'Aprano
steve+comp.lang.pyt...@pearwood.info wrote:
 This looks like the classic sigint handler sets a flag that the main
 loop polls structure.

 Exactly. I am open to alternative methods if they are lightweight.

Might be easiest to spin off a thread to do the work, and then have
the main thread block on the keyboard.

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


Re: python shell that saves history of typed in commands that will persist between reboots

2011-11-23 Thread Chris Angelico
On Thu, Nov 24, 2011 at 5:11 PM, Steven D'Aprano
steve+comp.lang.pyt...@pearwood.info wrote:
 One of us is confused, and I'm pretty sure it's you :)

 Tim went on to say Obviously this only applies when an underlying cmd
 session persists, which I understood as implying that he too is using
 Linux where Ctrl-Z stops the process, but does not exit it.

Entirely possible :) I blithely assumed from the fact that he said
dir that it was Windows, but it goes to show what happens when you
assume.

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


Does py2app improves speed?

2011-11-23 Thread Ricardo Mansilla
Hi everyone..
My question is exactly as in the subject of This Mail. 
I have made a Python  script which is to slow and i have heard (and common 
sense also suggest) that if you use some libraries to frozen the script the 
performance improves substantially. So I need to know; is This a myth or it is 
a fact?
Thanks in advance for your time. 
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Capturing SIGSTOP

2011-11-23 Thread Steven D'Aprano
On Thu, 24 Nov 2011 15:22:23 +1100, Chris Angelico wrote:

 On Thu, Nov 24, 2011 at 2:29 PM, Steven D'Aprano
 steve+comp.lang.pyt...@pearwood.info wrote:
 Is there a way to catch SIGSTOP?
 
 In the strictest sense, no; SIGSTOP can't be caught. However, some
 systems have SIGTSTP which is sent when you hit Ctrl-Z, which would be
 what you're looking for.

That's exactly what I'm looking for, thanks.

After catching the interrupt and doing whatever I need to do, I want to 
allow the process to be stopped as normal. Is this the right way?

import signal, os

def handler(signalnum, stackframe):
print Received signal %d % signalnum
os.kill(os.getpid(), signal.SIGSTOP)  # Hit myself with a brick.

signal.signal(signal.SIGTSTP, handler)


It seems to work for me (on Linux), but is it the right way?



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


Re: What I do and do not know about installing Python on Win 7 with regard to IDLE.

2011-11-23 Thread Michael Torrie
On 11/22/2011 09:14 AM, W. eWatson wrote:
 On 11/21/2011 7:00 PM, alex23 wrote:
 W. eWatsonwolftra...@invalid.com  wrote:
 Comments?

 Please don't start multiple threads on the same issue.
 Your joking, right, or do you just prefer 500 line threads wandering all 
 over the place?

Most of us use threaded e-mail clients or nntp clients (Gmail's
conversations are rubbish for this kind of thing) and so yes, having all
500 responses wandering all over the place in an orderly tree structure
is infinitely preferred to many threads all talking about the same
thing.  Each message contains a referral id that refers the message that
is being replied to.  Thus the logical flow of the conversation is
preserved very well despite many posters and meandering conversation
branches.
-- 
http://mail.python.org/mailman/listinfo/python-list


[issue12156] test_multiprocessing.test_notify_all() timeout (1 hour) on FreeBSD 7.2

2011-11-23 Thread Charles-François Natali

Charles-François Natali neolo...@free.fr added the comment:

Alright, the test is now skipped when the system doesn't support enough POSIX 
semaphores.
I'm closing, we can still reopen in case another similar problem pops up (on 
other OS of course).

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

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



[issue13415] del os.environ[key] ignores errors

2011-11-23 Thread Charles-François Natali

Charles-François Natali neolo...@free.fr added the comment:

 Oh, it looks like unsetenv() has no return value on Mac OS X Tiger

And neither does FreeBSD  7:
http://python.org/dev/buildbot/all/builders/x86%20FreeBSD%206.4%203.x/builds/2015/steps/compile/logs/stdio

Note that ignoring unsetenv() return value is a bad idea:
http://xorl.wordpress.com/category/freebsd/page/2/

We could maybe add a configure-time check.

--
nosy: +neologix

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



[issue13425] http.client.HTTPMessage.getallmatchingheaders() always returns []

2011-11-23 Thread Stanisław Jankowski

Stanisław Jankowski stach.jankow...@gmail.com added the comment:

 @stachjankowski: How did you find this issue? Are you porting from 2.x to 3.x 
 or have new 3.x code that uses this function?
No, it's just random finding.

--

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



[issue13459] logger.propagate=True behavior clarification

2011-11-23 Thread Roundup Robot

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

New changeset 2c173769a957 by Vinay Sajip in branch '2.7':
Closes #13459: Clarified documentation on Logger.propagate. Thanks to Mike 
Fogel for the patch.
http://hg.python.org/cpython/rev/2c173769a957

New changeset a9f5639e18a1 by Vinay Sajip in branch '3.2':
Closes #13459: Clarified documentation on Logger.propagate. Thanks to Mike 
Fogel for the patch.
http://hg.python.org/cpython/rev/a9f5639e18a1

New changeset cc6693fdf6d5 by Vinay Sajip in branch 'default':
Closes #13459: Merged fix from 3.2.
http://hg.python.org/cpython/rev/cc6693fdf6d5

--
nosy: +python-dev
resolution:  - fixed
stage:  - committed/rejected
status: open - closed

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



[issue13425] http.client.HTTPMessage.getallmatchingheaders() always returns []

2011-11-23 Thread Petri Lehtinen

Petri Lehtinen pe...@digip.org added the comment:

 No, it's just random finding.

This strengthens my impression that no-one is actually using the function. 
Maybe we should just remove it from 3.3.

--

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



[issue13415] del os.environ

2011-11-23 Thread STINNER Victor

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

 Note that ignoring unsetenv() return value is a bad idea:
 http://xorl.wordpress.com/category/freebsd/page/2/

Oh yeah, I remember this critical (local) vulnerability!

 We could maybe add a configure-time check.

Yes, it sounds like the best solution.

--
title: del os.environ[key] ignores errors - del os.environ

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



[issue13425] http.client.HTTPMessage.getallmatchingheaders() always returns

2011-11-23 Thread Senthil Kumaran

Senthil Kumaran sent...@uthcode.com added the comment:

Let's make it useful, that's much better instead of removing it. I am
+1 with Ezio's suggestion on this to return a list of tuples with
matching headers.

--
title: http.client.HTTPMessage.getallmatchingheaders() always returns [] - 
http.client.HTTPMessage.getallmatchingheaders() always returns

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



[issue13439] turtle docstring for onkeyrelease references onkey, not onkeyrelease

2011-11-23 Thread Christopher Smith

Christopher Smith smi...@users.sourceforge.net added the comment:

Sorry for the misdirection:

The docstring example for onkeypress is written using onkey instead of 
onkeypress. (There is no problem for onkey and onkeyrelease.)

--
resolution: wont fix - 
status: closed - open

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



[issue13425] http.client.HTTPMessage.getallmatchingheaders() always returns

2011-11-23 Thread Petri Lehtinen

Petri Lehtinen pe...@digip.org added the comment:

 Let's make it useful, that's much better instead of removing it. I am
 +1 with Ezio's suggestion on this to return a list of tuples with
 matching headers.

But there's already a function that does it:

http://docs.python.org/dev/library/email.message.html#email.message.Message.get_all

HTTPMessage is a subclass of email.message.Message, so it's available in 
HTTPMessage as well.

--

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



[issue12328] multiprocessing's overlapped PipeConnection on Windows

2011-11-23 Thread sbt

sbt shibt...@gmail.com added the comment:

 I have the feeling that if we have to call GetLastError() at the
 Python level, then there's something wrong with the APIs we're 
 exposing from the C extension. 
 I see you check for ERROR_OPERATION_ABORTED. Is there any situation
 where this can happen?

There are three expected error conditions:

ERROR_OPERATION_ABORTED: operation stopped by CancelIo(Ex)()
ERROR_MORE_DATA: operation complete, but only got part of the message
ERROR_IO_INCOMPLETE: operation still has not finished

In the win32 api you need GetLastError() to distinguish between these cases, 
but maybe we can expose something better.

 Also, it seems strange to call ov.cancel() and then
 ov.GetOverlappedResult(). AFAICT, those two operations should be
 mutually exclusive: you call the former if e.g. WaitForMultipleObjects
 raised an exception, the latter otherwise.

If WaitForMultipleObjects() returns WAIT_OBJECT_0 + 0 then, as you say, there 
is no need to call ov.cancel(), but it is harmless to call it if the operation 
has already completed. 

The cases aren't really mutually exclusive: if you call ov.cancel() you *must* 
still do ov.GetOverlappedResult(True) to check for the race where the operation 
completes after the wait times out, but before ov.cancel() can stop it.  (Your 
original implementation had that bug -- see point (5) in my original bug 
report.)

--

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



[issue13446] imaplib, fetch: improper behaviour on read-only selected mailboxes

2011-11-23 Thread Charalampos Nikolaou

Charalampos Nikolaou char.nikol...@gmail.com added the comment:

Hi, actually I must have found the real culprit. And this is that imaplib does 
not include a function for the EXAMINE command. What it does is that when a 
user selects a mailbox as readonly, it executes an EXAMINE command instead of a 
SELEECT command, which is wrong according to RFC2060 
(http://james.apache.org/server/rfclist/imap4/rfc2060.txt) that explicitly 
states the following:

Read-only access through SELECT differs from the EXAMINE command in that 
certain read-only mailboxes MAY permit the change of permanent state on a 
per-user (as opposed to global) basis.  Netnews messages marked in  a 
server-based .newsrc file are an example of such per-user permanent state that 
can be modified with read-only mailboxes.

As a consequence of the above text, if a mailbox has been selected with the 
EXAMINE command, fetching a mail does not make the mail as read, which would be 
done if the mailbox had been selected with the SELECT command even in the case 
the mailbox had read-only permissions.

A quick patch for imaplib is to have it not raising any exceptions when 
checking the READ-ONLY state. In this way, one can open a read-only mailbox 
using the SELECT command as follows:

imap.select(mailbox)

Preventing imaplib from raising exceptions when using the above command with 
read-only mailboxes, it allows someone to fetch a message and then marked it as 
seen. After all, the exceptions are of no use, because the IMAP server is 
responsible for making security checks and not the client.

To have imaplib be compliant with RFC2060, I propose including an examine 
function which would be like select. Pure and simply.

I attach a patch for imaplib 2.58 (Python 2.6.2) which solves this 
misbehavior by not raising exceptions for READ-ONLY mailboxes when having 
opened them without readonly=True. 

What are your opinions on this?

--
keywords: +patch
Added file: http://bugs.python.org/file23762/imaplib.patch

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



[issue1395] py3k: duplicated line endings when using read(1)

2011-11-23 Thread Sébastien Sablé

Sébastien Sablé sa...@users.sourceforge.net added the comment:

I am trying to get Python working when compiled with Visual Studio 2010 (cf 
issue 13210).

When running the tests with the python 2.7 branch compiled with VS2010, the 
test_issue_1395_5 in test_io.py will cause Python to eat the whole memory 
within a few seconds and make the server completely unresponsive.

--
nosy: +sable

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



[issue1395] py3k: duplicated line endings when using read(1)

2011-11-23 Thread STINNER Victor

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


--
nosy: +haypo

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



[issue1395] py3k: duplicated line endings when using read(1)

2011-11-23 Thread Amaury Forgeot d'Arc

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

You should open a new issue for this new problem.

--

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



[issue13461] Error on test_issue_1395_5 with Python 2.7 and VS2010

2011-11-23 Thread Sébastien Sablé

New submission from Sébastien Sablé sa...@users.sourceforge.net:

I am trying to get Python working when compiled with Visual Studio 2010 (cf 
issue 13210).

When running the tests with the python 2.7 branch compiled with VS2010, the 
test_issue_1395_5 in test_io.py will cause Python to eat the whole memory 
within a few seconds and make the server completely unresponsive.

--
components: IO
messages: 148184
nosy: sable
priority: normal
severity: normal
status: open
title: Error on test_issue_1395_5 with Python 2.7 and VS2010
versions: Python 2.7

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



[issue1395] py3k: duplicated line endings when using read(1)

2011-11-23 Thread Sébastien Sablé

Sébastien Sablé sa...@users.sourceforge.net added the comment:

OK, sorry. Done in issue 13461.

--

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



[issue13461] Error on test_issue_1395_5 with Python 2.7 and VS2010

2011-11-23 Thread Sébastien Sablé

Sébastien Sablé sa...@users.sourceforge.net added the comment:

The problem is in CTextIOWrapperTest.test_issue1395_5
Here is the backtrace:

msvcr100d.dll!memset()  Line 145Asm
   msvcr100d.dll!_heap_alloc_dbg_impl(unsigned __int64 nSize, int 
 nBlockUse, const char * szFileName, int nLine, int * errno_tmp)  Line 498 
C++
msvcr100d.dll!_nh_malloc_dbg_impl(unsigned __int64 nSize, int nhFlag, 
int nBlockUse, const char * szFileName, int nLine, int * errno_tmp)  Line 239 + 
0x22 bytesC++
msvcr100d.dll!_nh_malloc_dbg(unsigned __int64 nSize, int nhFlag, int 
nBlockUse, const char * szFileName, int nLine)  Line 302 + 0x2a bytes  C++
msvcr100d.dll!malloc(unsigned __int64 nSize)  Line 56 + 0x21 bytes  
C++
python27_d.dll!PyObject_Malloc(unsigned __int64 nbytes)  Line 944   
C
python27_d.dll!_PyObject_DebugMallocApi(char id, unsigned __int64 
nbytes)  Line 1445 + 0xa bytesC
python27_d.dll!_PyObject_DebugMalloc(unsigned __int64 nbytes)  Line 
1413C
python27_d.dll!PyString_FromStringAndSize(const char * str, __int64 
size)  Line 88 + 0x11 bytes C
python27_d.dll!do_mkvalue(const char * * p_format, char * * p_va, int 
flags)  Line 427 + 0xf bytes  C
python27_d.dll!va_build_value(const char * format, char * va, int 
flags)  Line 537 + 0x14 bytes C
python27_d.dll!_Py_VaBuildValue_SizeT(const char * format, char * va)  
Line 511 C
python27_d.dll!_PyObject_CallMethod_SizeT(_object * o, char * name, 
char * format, ...)  Line 2671 + 0xf bytes  C
python27_d.dll!textiowrapper_tell(textio * self, _object * args)  Line 
 + 0x2c bytesC



So the problem happens when calling in textio.c:
{{{
PyObject *decoded = PyObject_CallMethod(
self-decoder, decode, s#, input, 1);
}}}

self-decoder is of type _io.IncrementalNewlineDecoder and input is BBB.

This will result in PyString_FromStringAndSize being called with size = 
4294967297, which will cause the server to fall.

--

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



[issue12328] multiprocessing's overlapped PipeConnection on Windows

2011-11-23 Thread Antoine Pitrou

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

 There are three expected error conditions:
 
 ERROR_OPERATION_ABORTED: operation stopped by CancelIo(Ex)()
 ERROR_MORE_DATA: operation complete, but only got part of the message
 ERROR_IO_INCOMPLETE: operation still has not finished
 
 In the win32 api you need GetLastError() to distinguish between these
 cases, but maybe we can expose something better.

It seems to me that ERROR_OPERATION_ABORTED is a true error, and so
should raise an exception.

 The cases aren't really mutually exclusive: if you call ov.cancel()
 you *must* still do ov.GetOverlappedResult(True) to check for the race
 where the operation completes after the wait times out, but before
 ov.cancel() can stop it.  (Your original implementation had that bug
 -- see point (5) in my original bug report.)

Ah, right. Thanks for the explanation.

--

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



[issue13462] Improve code and tests for Mixin2to3

2011-11-23 Thread Éric Araujo

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

Currently distutils2 has two classes and one function to perform 2to3 
conversion in the build_py and build_scripts commands.  The code is a bit messy 
and also lack tests, for example for the conversion of doctests in text files.  
I’ve started revamping it so that it’s only one class that does the work, and I 
will also add many tests.

Benjamin: For Python 2.4 and 2.5, should the functionality just be unavailable 
or is there an official release of lib2to3 on PyPI?  I only found two2three, an 
old copy from the Subversion sandbox done by 3to2’s Joe Amenta, so I’m not sure 
I can be compatible with that (or if it’s even useful to try to convert 2.4 
code to 3.x).

--
assignee: eric.araujo
components: Distutils2
messages: 148188
nosy: alexis, benjamin.peterson, eric.araujo
priority: release blocker
severity: normal
status: open
title: Improve code and tests for Mixin2to3
type: behavior
versions: 3rd party, Python 3.3

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



[issue12618] py_compile cannot create files in current directory

2011-11-23 Thread Éric Araujo

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

Meador, maybe you would like to commit the tests (except for the one that’s the 
object of this report) yourself?  I don’t mind doing it, but as you have push 
rights now maybe you prefer to have your name directly associated with your 
work.

--

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



[issue13420] newer() function in dep_util.py discard changes in the same second

2011-11-23 Thread Éric Araujo

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

It’s a bit hard for me to isolate the distutils problem from the CDBS-specific 
parts (maybe because I’m tired :).  For years, sub-second resolution was not 
supported by distutils, and things were okay as long as the build* commands did 
the file creation and install* were only concerned with copying files.  Given 
the feature freeze, I’m very reluctant to add sub-second resolution.

--

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



[issue13462] Improve code and tests for Mixin2to3

2011-11-23 Thread Benjamin Peterson

Benjamin Peterson benja...@python.org added the comment:

Yes, last time I checked 2to3 doesn't work on 2.5 or 2.4. People will just have 
to run build_py2to3 on 2.6+.

--

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



[issue10318] make altinstall installs many files with incorrect shebangs

2011-11-23 Thread Éric Araujo

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

 Hmm, my initial reaction is that that specific wording is stronger than I had 
 in mind -
 there's nothing really wrong with having a shebang line and execute bit set 
 on a top level
 module and symlinking it from /usr/bin.
Okay.  (On that topic, 
http://lists.debian.org/debian-python/2011/11/msg00058.html may interest you.)

 The problem is that we're doing those things for modules that we *don't* 
 install as binaries,
 and that's silly
Yep.  Attached patch removes them for 3.3.

 I'd also mention the justification that this is due to such shebang lines 
 creating a
 maintenance problem for handling parallel installations of different Python 
 versions.
I’d rather just say that it’s unneeded.  With all due respect to the original 
poster, I don’t think this really caused problems.


I will move my addition to the stdlib-only section.  I’m not sure about 
OS-neutrality; the executable bit is Unix-specific and I’d rather use that 
exact term than a vague “flagged as executable”.  I’ll make the part about 
shebangs neutral however, it won’t be hard.

About this part of your proposal:
 Any installed scripts should use a shebang line of the form::
#!/usr/bin/env pythonX.Y
Due to the use of distutils’ build_scripts that hard-codes one path, I’m not 
sure it’s time yet to make that recommendation.  For packaging, I intend to 
launch a discussion about that behavior, which is often unhelpful.

I really appreciate your taking time to review, and will submit the next 
revision of the patch here before going to python-dev.

--
Added file: http://bugs.python.org/file23763/no-shebangs-for-stdlib.diff

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



[issue13455] Reorganize tracker docs in the devguide

2011-11-23 Thread Éric Araujo

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

+1 on grouping existing info into one or two files in the devguide
+1 to removing the wiki pages
+1 on keeping some basic directions in the main docs

--

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



[issue13463] Fix parsing of package_data

2011-11-23 Thread Éric Araujo

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

In 288640098ea8, Jeremy fixed a bug in distutils2.config that prevented d2’s 
own setup.py script from working.  I had to revert that change because it 
caused tests to fail.  The bug needs to be identified exactly, then a test for 
it is needed, and finally an sdist should be created to check that all files 
are included.

As I want to release 1.0a4 very soon, I’ll work on this today or tomorrow.

--
assignee: eric.araujo
components: Distutils2
messages: 148194
nosy: alexis, eric.araujo
priority: release blocker
severity: normal
stage: test needed
status: open
title: Fix parsing of package_data
type: behavior
versions: 3rd party, Python 3.3

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



[issue13009] Remove documentation in distutils2 repo

2011-11-23 Thread Éric Araujo

Changes by Éric Araujo mer...@netwok.org:


--
priority: normal - release blocker

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



[issue12934] pysetup doesn’t work for the docutils project

2011-11-23 Thread Éric Araujo

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

Due to the same reason, it’s also not possible to run “pysetup3.1 metadata” in 
the distutils2 repo, or “pysetup2.4 metadata” in the distutils2-python3 repo.

--

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



[issue12779] Update packaging documentation

2011-11-23 Thread Éric Araujo

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

Making this a release blocker for d2 1.0a4.

--
priority: normal - release blocker

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



[issue13125] test_all_project_files() expected failure

2011-11-23 Thread Antoine Pitrou

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

Ping.

--

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



[issue13444] closed stdout causes error on stderr when the interpreter unconditionally flushes on shutdown

2011-11-23 Thread Ronny Pfannschmidt

Ronny Pfannschmidt ronny.pfannschm...@gmail.com added the comment:

i think checking for closed is the correct solution

--

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



[issue13464] HTTPResponse is missing an implementation of readinto

2011-11-23 Thread R. David Murray

New submission from R. David Murray rdmur...@bitdance.com:

HTTPResponse subclasses RawIOBase, but does not provide an implementation of 
readinto, only read.  This means that it is not conforming to the IO spec, and 
so it cannot be wrapped in a BufferedIOBase when using the C version of io.

--
components: Library (Lib)
keywords: easy
messages: 148199
nosy: orsenthil, pitrou, r.david.murray
priority: normal
severity: normal
status: open
title: HTTPResponse is missing an implementation of readinto
type: behavior
versions: Python 3.2, Python 3.3

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



[issue12578] Erratic socket.gaierror: [Errno 11004] when using smtplib

2011-11-23 Thread Charles-François Natali

Changes by Charles-François Natali neolo...@free.fr:


--
resolution:  - invalid
stage: test needed - committed/rejected
status: pending - closed

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



[issue13415] del os.environ

2011-11-23 Thread Charles-François Natali

Changes by Charles-François Natali neolo...@free.fr:


--
keywords: +needs review
stage:  - patch review
Added file: http://bugs.python.org/file23764/broken_unsetenv.diff

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



[issue13465] A Jython section in the dev guide would be great

2011-11-23 Thread Frank Wierzbicki

New submission from Frank Wierzbicki fwierzbi...@gmail.com:

Nick suggested this as a comment on a blog post of mine -- I'll come up with 
some content, but I wanted to log the bug straight away so I wouldn't forget.

--
components: Devguide
messages: 148200
nosy: brett.cannon, ezio.melotti, fwierzbicki, ncoghlan
priority: normal
severity: normal
status: open
title: A Jython section in the dev guide would be great
type: feature request

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



[issue13425] http.client.HTTPMessage.getallmatchingheaders() always returns

2011-11-23 Thread Stanisław Jankowski

Stanisław Jankowski stach.jankow...@gmail.com added the comment:

This issue has been reported previously, in issue5053. Unfortunately, I 
overlooked. Sorry.

--
resolution:  - duplicate
status: open - closed

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



[issue5054] CGIHTTPRequestHandler.run_cgi() HTTP_ACCEPT improperly parsed

2011-11-23 Thread Petri Lehtinen

Changes by Petri Lehtinen pe...@digip.org:


--
nosy: +petri.lehtinen

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



[issue5053] http.client.HTTPMessage.getallmatchingheaders() always returns []

2011-11-23 Thread Petri Lehtinen

Changes by Petri Lehtinen pe...@digip.org:


--
nosy: +petri.lehtinen

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



[issue13425] http.client.HTTPMessage.getallmatchingheaders() always returns

2011-11-23 Thread Petri Lehtinen

Changes by Petri Lehtinen pe...@digip.org:


--
superseder:  - http.client.HTTPMessage.getallmatchingheaders() always returns 
[]

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



[issue13425] http.client.HTTPMessage.getallmatchingheaders() always returns []

2011-11-23 Thread Petri Lehtinen

Changes by Petri Lehtinen pe...@digip.org:


--
title: http.client.HTTPMessage.getallmatchingheaders() always returns - 
http.client.HTTPMessage.getallmatchingheaders() always returns []

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



[issue5053] http.client.HTTPMessage.getallmatchingheaders() always returns []

2011-11-23 Thread Petri Lehtinen

Petri Lehtinen pe...@digip.org added the comment:

#13425 was marked as duplicate of this issue.

--

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



[issue4773] HTTPMessage not documented and has inconsistent API across 2.6/3.0

2011-11-23 Thread Petri Lehtinen

Changes by Petri Lehtinen pe...@digip.org:


--
nosy: +petri.lehtinen

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



[issue13439] turtle: Errors in docstrings of onkey and onkeypress

2011-11-23 Thread Petri Lehtinen

Petri Lehtinen pe...@digip.org added the comment:

There are actually many problems with docstrings of both onkey() and 
onkeypress().

Both:

- Turtle instance named turtle isn't used in the example

- The repl/doctest syntax is weird

onkeypress only:

- key-press event vs. key-press-event

- The example uses onkey() instead of onkeypress()

- The bottom comment says that the example draws a hexagon, but it actually 
draws a straight line.

--
stage: committed/rejected - 
title: turtle docstring for onkeyrelease references onkey, not onkeyrelease - 
turtle: Errors in docstrings of onkey and onkeypress

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



[issue13466] new timezones

2011-11-23 Thread Aleksey

New submission from Aleksey shits...@gmail.com:

Hi Guys,
Since 31 august 2011 in Russian Federation always DST time.
http://worldtimezone.net/dst_news/dst_news_russia36.html

But
 time.tzname
('MSK', 'MSK')
 time.localtime().tm_isdst
0
 time.timezone
-10800
 time.altzone
-14400

i think tm_isdst must be always 1 for my zone, or timezone must be equal altzone

--
messages: 148204
nosy: Rioky
priority: normal
severity: normal
status: open
title: new timezones
type: behavior
versions: Python 2.7

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



[issue13439] turtle: Errors in docstrings of onkey and onkeypress

2011-11-23 Thread Petri Lehtinen

Petri Lehtinen pe...@digip.org added the comment:

The problems with onkey() are also there in 2.7. onkeypress() is new in 3.x.

--
keywords: +easy
stage:  - needs patch
versions: +Python 2.7

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



[issue13466] new timezones

2011-11-23 Thread Ezio Melotti

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


--
components: +Extension Modules
nosy: +belopolsky, lemburg
stage:  - test needed
versions: +Python 3.2, Python 3.3

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




  1   2   >