pyPEG 2.10 released

2013-02-11 Thread Volker Birk
Hello, pyPEG 2.10 is a maintenance release. Now optional attributes are supported by the XML backend. There are several bugfixes. pyPEG 2 for Python 2.7 and 3.x Python is a nice scripting language. It even gives you access to its own parser and compiler. It also gives you access to different

Jython 2.5.4rc1 and Jython 2.7b1 released!

2013-02-11 Thread Frank Wierzbicki
On behalf of the Jython development team, I'm pleased to announce that the first release candidate of Jython 2.5.4 and the first beta of Jython 2.7 are available. The 2.5.4rc1 details are here: http://fwierzbicki.blogspot.com/2013/02/jython-254-rc1-released.html The 2.7b1 details are here:

[2.4.3/Newbie] Web script doesn't run

2013-02-11 Thread Gilles
Hello I have a couple of newbie questions about using Python in a FastCGI + Flup context on a shared CentOS server: 1. The following script runs fine... = #!/usr/bin/env python2.6 def myapp(environ, start_response): start_response('200 OK',

Re: [2.4.3/Newbie] Web script doesn't run

2013-02-11 Thread Gilles
On Mon, 11 Feb 2013 10:30:01 +0100, Gilles nos...@nospam.com wrote: I have a couple of newbie questions about using Python in a FastCGI + Flup context on a shared CentOS server: Please ignore the thread. I found the error, and a way to catch compile-time errors (log on through SSH, and run

Re: [2.4.3/Newbie] Web script doesn't run

2013-02-11 Thread Chris Angelico
On Mon, Feb 11, 2013 at 8:39 PM, Gilles nos...@nospam.com wrote: On Mon, 11 Feb 2013 10:30:01 +0100, Gilles nos...@nospam.com wrote: I have a couple of newbie questions about using Python in a FastCGI + Flup context on a shared CentOS server: Please ignore the thread. I found the error,

Error in reading and writing CSV format file in python

2013-02-11 Thread inshu chauhan
In the programme below I am trying to read two csv format files and process them and write a new file with some of theirs data. import csv f1_reader = csv.reader(open(rZ:\Weka work\Feature_Vectors_Fullset_00.arff)) f2_reader = csv.reader(open(rZ:\Weka

Re: [2.4.3/Newbie] Web script doesn't run

2013-02-11 Thread Gilles
On Mon, 11 Feb 2013 21:30:12 +1100, Chris Angelico ros...@gmail.com wrote: That'll catch some forms of error, but not everything. You may also want to consider looking for your server's error log - that may be getting the actual traceback. I don't know what your server setup is, but there's likely

Re: [2.4.3/Newbie] Web script doesn't run

2013-02-11 Thread Chris Angelico
On Mon, Feb 11, 2013 at 10:22 PM, Gilles nos...@nospam.com wrote: On Mon, 11 Feb 2013 21:30:12 +1100, Chris Angelico ros...@gmail.com wrote: That'll catch some forms of error, but not everything. You may also want to consider looking for your server's error log - that may be getting the actual

Re: [2.4.3/Newbie] Web script doesn't run

2013-02-11 Thread Gilles
On Mon, 11 Feb 2013 22:30:45 +1100, Chris Angelico ros...@gmail.com wrote: Try running python2.6 -V Your shebang line says that it's looking for a program named python2.6, which is quite probably not the same as the one named just python. Indeed, they have two versions of Python installed: #

Re: [2.4.3/Newbie] Web script doesn't run

2013-02-11 Thread Chris Angelico
On Mon, Feb 11, 2013 at 10:36 PM, Gilles nos...@nospam.com wrote: On Mon, 11 Feb 2013 22:30:45 +1100, Chris Angelico ros...@gmail.com wrote: Try running python2.6 -V Your shebang line says that it's looking for a program named python2.6, which is quite probably not the same as the one named

Re: LangWart: Method congestion from mutate multiplicty

2013-02-11 Thread Tim Chase
On Mon, 11 Feb 2013 18:24:05 +1100 Chris Angelico ros...@gmail.com wrote: Is that Unicode string theory or ASCII string theory? +1 QOTW :-) -tkc -- http://mail.python.org/mailman/listinfo/python-list

Re: [2.4.3/Newbie] Web script doesn't run

2013-02-11 Thread Gilles
On Mon, 11 Feb 2013 22:42:50 +1100, Chris Angelico ros...@gmail.com wrote: It's entirely possible you have a third Python, a 3.x, as well. Different Pythons coexist quite happily on a system. Thank for the help. I'm on my way to figure out how mod_fcgid, Flup, and Python scripts work together. --

Re: Implicit conversion to boolean in if and while statements

2013-02-11 Thread Rick Johnson
On Sunday, February 10, 2013 5:37:46 AM UTC-6, Steven D'Aprano wrote: Rick Johnson wrote: IMO Set Types should only exists as a concequence of freezing an array, Sets are not frozen lists. Indeed. That wording was a bit clumsy on my part. and should have NO literal syntax available.

Re: Error in reading and writing CSV format file in python

2013-02-11 Thread MRAB
On 2013-02-11 11:00, inshu chauhan wrote: In the programme below I am trying to read two csv format files and process them and write a new file with some of theirs data. import csv f1_reader = csv.reader(open(rZ:\Weka work\Feature_Vectors_Fullset_00.arff)) f2_reader = csv.reader(open(rZ:\Weka

Re: Import redirects

2013-02-11 Thread Oscar Benjamin
On 11 February 2013 06:50, Isaac To isaac...@gmail.com wrote: I have a package (say foo) that I want to rename (say, to bar), and for compatibility reasons I want to be able to use the old package name to refer to the new package. Copying files or using filesystem symlinks is probably not the

Re: Implicit conversion to boolean in if and while statements

2013-02-11 Thread Rick Johnson
On Saturday, February 9, 2013 11:04:42 PM UTC-6, Chris Angelico wrote: On Sun, Feb 10, 2013 at 3:54 PM, Rick Johnson wrote: Well Chris i have wonderful news for you! Python /does/ have homogenous arrays, and they're called, wait for it. arrays! That's not a built-in. But you were

Re: Error in reading and writing CSV format file in python

2013-02-11 Thread Steven D'Aprano
inshu chauhan wrote: In the programme below I am trying to read two csv format files and process them and write a new file with some of theirs data. import csv f1_reader = csv.reader(open(rZ:\Weka work\Feature_Vectors_Fullset_00.arff)) f2_reader = csv.reader(open(rZ:\Weka

Re: Implicit conversion to boolean in if and while statements

2013-02-11 Thread Chris Angelico
On Mon, Feb 11, 2013 at 11:18 PM, Rick Johnson rantingrickjohn...@gmail.com wrote: On Sunday, February 10, 2013 5:37:46 AM UTC-6, Steven D'Aprano wrote: Rick Johnson wrote: IMO Set Types should only exists as a concequence of freezing an array, Sets are not frozen lists. Indeed. That

Re: Error in reading and writing CSV format file in python

2013-02-11 Thread inshu chauhan
On Mon, Feb 11, 2013 at 1:26 PM, Steven D'Aprano steve+comp.lang.pyt...@pearwood.info wrote: inshu chauhan wrote: In the programme below I am trying to read two csv format files and process them and write a new file with some of theirs data. import csv f1_reader =

Re: Implicit conversion to boolean in if and while statements

2013-02-11 Thread Chris Angelico
On Mon, Feb 11, 2013 at 11:28 PM, Rick Johnson rantingrickjohn...@gmail.com wrote: On Saturday, February 9, 2013 11:04:42 PM UTC-6, Chris Angelico wrote: On Sun, Feb 10, 2013 at 3:54 PM, Rick Johnson wrote: Well Chris i have wonderful news for you! Python /does/ have homogenous arrays, and

Re: LangWart: Method congestion from mutate multiplicty

2013-02-11 Thread Rick Johnson
On Sunday, February 10, 2013 6:36:20 PM UTC-6, Steven D'Aprano wrote: Rick Johnson wrote: On Sunday, February 10, 2013 5:29:54 AM UTC-6, Steven D'Aprano wrote: Rick wrote: [...] Steven, the definition of flatten (as relates to sequences) is very, VERY simple: Return a new

Re: Error in reading and writing CSV format file in python

2013-02-11 Thread MRAB
On 2013-02-11 12:44, inshu chauhan wrote: On Mon, Feb 11, 2013 at 1:26 PM, Steven D'Aprano steve+comp.lang.pyt...@pearwood.info mailto:steve+comp.lang.pyt...@pearwood.info wrote: inshu chauhan wrote: In the programme below I am trying to read two csv format files and process

Re: Error in reading and writing CSV format file in python

2013-02-11 Thread inshu chauhan
On Mon, Feb 11, 2013 at 2:02 PM, MRAB pyt...@mrabarnett.plus.com wrote: On 2013-02-11 12:44, inshu chauhan wrote: On Mon, Feb 11, 2013 at 1:26 PM, Steven D'Aprano steve+comp.lang.python@**pearwood.infosteve%2bcomp.lang.pyt...@pearwood.info

Re: Implicit conversion to boolean in if and while statements

2013-02-11 Thread Rick Johnson
On Monday, February 11, 2013 6:40:23 AM UTC-6, Chris Angelico wrote: [...] Or doing what you were pointing and laughing at Pike for, and using two-symbol delimiters. You could even make it majorly logical: list_ = [[ 1, 2, 3 ]] tuple_ = ([ 1, 2, 3 ]) dict_ = [{ 1, 2, 3 }] frozendict_ = ({

Re: LangWart: Method congestion from mutate multiplicty

2013-02-11 Thread Chris Angelico
On Mon, Feb 11, 2013 at 11:53 PM, Rick Johnson rantingrickjohn...@gmail.com wrote: Which primitive(s) should NOT have been expanded in your opinion? The Point object? I agree, that's why MY implementation would call seq.flatten() on all sub-sequences THEREBY allowing each subtype to define

Re: Implicit conversion to boolean in if and while statements

2013-02-11 Thread Rick Johnson
On Monday, February 11, 2013 6:50:03 AM UTC-6, Chris Angelico wrote: On Mon, Feb 11, 2013 at 11:28 PM, Rick Johnson Well i would expect anyone who considers himself a python programmer (not to mention pythonista!) to at minimum be familiar with the stdlib. [...] [...] If there is

Re: Implicit conversion to boolean in if and while statements

2013-02-11 Thread Chris Angelico
On Tue, Feb 12, 2013 at 12:13 AM, Rick Johnson rantingrickjohn...@gmail.com wrote: I am vehemently against using more than one opening seq char and one closing seq char. ... we could use start and end tags like: set{1,2,3}set where set{ and }set are delimiters. Interesting. So what

Re: Logging within a class

2013-02-11 Thread Jean-Michel Pichavant
- Original Message - Within __init__ I setup a log with self.log = logging.getLogger('foo') then add a console and filehandler which requires the formatting to be specified. There a few methods I setup a local log object by calling getChild against the global log object. This

Re: Implicit conversion to boolean in if and while statements

2013-02-11 Thread Chris Angelico
On Tue, Feb 12, 2013 at 12:28 AM, Rick Johnson rantingrickjohn...@gmail.com wrote: I am sure there are quite a few Chris. But if you expect to around making statements like: Python does not have typed arrays, then don't get all upset when someone corrects you. Oh, I don't mind being

Re: Error in reading and writing CSV format file in python

2013-02-11 Thread Dave Angel
On 02/11/2013 06:00 AM, inshu chauhan wrote: In the programme below I am trying to read two csv format files and process them and write a new file with some of theirs data. import csv f1_reader = csv.reader(open(rZ:\Weka work\Feature_Vectors_Fullset_00.arff)) f2_reader =

Re: Alternative to Apache+mod_fcgid+Flup?

2013-02-11 Thread Chris Rebert
On Feb 11, 2013 6:16 AM, Gilles nos...@nospam.com wrote: Hello I read this article... Why is WSGI deployment under FASTCGI so painful? http://blog.dscpl.com.au/2011/09/why-is-wsgi-deployment-under-fastcgi-so.html ... and was wondering what better alternative is available to run Python

Re: Error in reading and writing CSV format file in python

2013-02-11 Thread inshu chauhan
On Mon, Feb 11, 2013 at 3:22 PM, Dave Angel da...@davea.name wrote: On 02/11/2013 06:00 AM, inshu chauhan wrote: In the programme below I am trying to read two csv format files and process them and write a new file with some of theirs data. import csv f1_reader = csv.reader(open(rZ:\Weka

Re: Python recv loop

2013-02-11 Thread Ihsan Junaidi Ibrahim
Hi Roy, On Feb 11, 2013, at 10:24 AM, Roy Smith r...@panix.com wrote: Is this server that you're talking to something that you have control over, i.e. are you stuck with this protocol? Given a choice, I'd go with something like JSON, for which pre-existing libraries for every language

Re: Python recv loop

2013-02-11 Thread Ihsan Junaidi Ibrahim
Hi Dave, On Feb 11, 2013, at 9:22 AM, Dave Angel da...@davea.name wrote: Exactly how are you sending hexadecimal ? If that 0xad (which is only one byte, what about the other 3 ?) is intended to be a C description, then it's certainly not hex, it's binary. And probably little-endian, to

matplotlib - removing text from a figure - a bug?

2013-02-11 Thread Raphael Mameghani
Does anyone know if the following error message is a matplotlib bug? Is there an correct/alternative way to remove (or replace) text? Thank you, Raphael from matplotlib.figure import Figure fig = Figure() caption = fig.suptitle(test) caption.remove() Traceback (most recent call last): File

Re: Python recv loop

2013-02-11 Thread Ihsan Junaidi Ibrahim
Hi MRAB, My code now works thanks to your advice. {msgver: 1.0, msgid: 200, subcode: 100, appver: 1.0, appid: 1.0, data: {1: igb0, 2: igb1, ifcnt: 2}} connected to misty:8080 sending data 138 bytes sent: 0x86{msgver: 1.0, msgid: 200, subcode: 100, appver: 1.0, appid: 1.0, data: {1: igb0, 2:

Re: Python recv loop

2013-02-11 Thread MRAB
On 2013-02-11 14:56, Ihsan Junaidi Ibrahim wrote: Hi Roy, On Feb 11, 2013, at 10:24 AM, Roy Smith r...@panix.com wrote: Is this server that you're talking to something that you have control over, i.e. are you stuck with this protocol? Given a choice, I'd go with something like JSON, for

Re: Python recv loop

2013-02-11 Thread Chris Angelico
On Tue, Feb 12, 2013 at 2:11 AM, MRAB pyt...@mrabarnett.plus.com wrote: I probably wouldn't make it fixed length. I'd have the length in decimal followed by, say, \n. Or even followed by any non-digit. Chances are your JSON data begins with a non-digit, so you'd just have to insert a space in

Re: Python recv loop

2013-02-11 Thread Dave Angel
On 02/11/2013 10:02 AM, Ihsan Junaidi Ibrahim wrote: snip print 'message length is {0}'.format(nbuf) while True: buf = sock.recv(nbuf) if not buf: break This loop doesn't terminate till buf is zero length, which it will be eventually. At that

imp.load_module error in Python 3.3

2013-02-11 Thread Iuri
I want to load a file with an invalid module name (with a dash). filename = '...' # something like /my/path/to/ejtp-crypto with open(filename, 'rb') as fp: my_module = imp.load_module('crypto', fp, 'ejtp-crypto', ('.py', 'rb', imp.PY_SOURCE)) It works to all Python = 2.5, except

Compiling Python with static runtime library (VS2010)

2013-02-11 Thread Jonatan Magnusson
Hi I'm trying to build Python 3.3.0 on Windows using Visual Studio 2010 Express. I opened the solution (pcbuild.sln) and built the python project (including its dependencies of course) and that worked fine with just a few warnings. But I need to build Python using the the static C runtime so

PyDev, pep8.py conflict on spaces around negative numbers

2013-02-11 Thread Wanderer
If I check the 'Use space before and after operators? (+, -, /, *, //, **, etc.)' in the EclipsePyDevEditorCode Style Code Formatter, PyDev will insert a space before a negative number in a keyword parameter declaration. Pep8.py will then post a warning 'E251 no spaces around keyword /

Re: LangWart: Method congestion from mutate multiplicty

2013-02-11 Thread Serhiy Storchaka
On 11.02.13 09:24, Chris Angelico wrote: Can I get a ringside seat at the debate between Rick and jmf on which kind of string theory was the wronger decision? I want to see it. -- http://mail.python.org/mailman/listinfo/python-list

Re: PyDev, pep8.py conflict on spaces around negative numbers

2013-02-11 Thread MRAB
On 2013-02-11 16:39, Wanderer wrote: If I check the 'Use space before and after operators? (+, -, /, *, //, **, etc.)' in the EclipsePyDevEditorCode Style Code Formatter, PyDev will insert a space before a negative number in a keyword parameter declaration. Pep8.py will then post a warning 'E251

Re: PyWart: Namespace asinitiy and the folly of the global statement

2013-02-11 Thread Jason Swails
On Mon, Feb 11, 2013 at 1:27 AM, Chris Angelico ros...@gmail.com wrote: On Mon, Feb 11, 2013 at 1:42 PM, alex23 wuwe...@gmail.com wrote: On Feb 9, 2:25 pm, Michael Torrie torr...@gmail.com wrote: Rick seems to know his stuff about Tk programming, but his knowledge of programming language

Re: PyDev, pep8.py conflict on spaces around negative numbers

2013-02-11 Thread Wanderer
On Monday, February 11, 2013 1:09:38 PM UTC-5, MRAB wrote: On 2013-02-11 16:39, Wanderer wrote: If I check the 'Use space before and after operators? (+, -, /, *, //, **, etc.)' in the EclipsePyDevEditorCode Style Code Formatter, PyDev will insert a space before a negative number in a

Re: PyWart: Namespace asinitiy and the folly of the global statement

2013-02-11 Thread Michael Torrie
On 02/11/2013 11:32 AM, Jason Swails wrote: Perhaps that's your problem ;). Tkinter was the first--and only--GUI toolkit I learned [1] (I do almost exclusively CLI, and GUI only for fun -- and I program as a result of the work I do). Having no previous knowledge of any other GUI toolkit

Re: PyWart: Namespace asinitiy and the folly of the global statement

2013-02-11 Thread Chris Angelico
On Tue, Feb 12, 2013 at 6:15 AM, Michael Torrie torr...@gmail.com wrote: On 02/11/2013 11:32 AM, Jason Swails wrote: Perhaps that's your problem ;). Tkinter was the first--and only--GUI toolkit I learned [1] (I do almost exclusively CLI, and GUI only for fun -- and I program as a result of

Re: How to Send a Tweet from Python? I can read, but not post.

2013-02-11 Thread Steven D'Aprano
saqib.ali...@gmail.com wrote: I posted this on StackOverflow.com but haven't got a good response yet: http://stackoverflow.com/questions/14808245/python-why-cant-i-send-a-tweet I have tried two different packages python-twitter and tweepy but have not been successful using either

Re: Monitoring updating directory for image for GUI

2013-02-11 Thread ciscorucinski
WOW...I am thinking that all of this was actually unnecessary, I don't think I need a Queue, or List / Stack, or any traversal of the file system to accomplish this!! I only need one image displayed at a time and don't care about them after a newer image is generated. So my prototype of just

Re: Is Python programming language?

2013-02-11 Thread Dan Stromberg
Sent from my android phone. On Feb 9, 2013 6:41 PM, Terry Reedy tjre...@udel.edu wrote: On 2/9/2013 6:53 PM, Michael Torrie wrote: On 02/09/2013 04:26 PM, Tim Roberts wrote: Most people would call bash a scripting language, but it is also clearly a programming language. It has syntax,

Re: Monitoring updating directory for image for GUI

2013-02-11 Thread MRAB
On 2013-02-11 22:50, ciscorucin...@gmail.com wrote: [snip] So I would only create one image location at images\sheetMusic.png and that file would be continuously updated as new notes are streamed in. My monitor class (might be a legacy component now) would basically look for that one image -

Re: Python3 curses behavior

2013-02-11 Thread Dan Stromberg
Sent from my android phone. On Feb 10, 2013 2:09 PM, Vlasov Vitaly vnig...@gmail.com wrote: суббота, 9 февраля 2013 г., 23:22:47 UTC+4 пользователь Terry Reedy написал: On 2/9/2013 6:23 AM, Vlasov Vitaly wrote: -- Terry Jan Reedy Thank you. I tried everything in my test script.

Re: Implicit conversion to boolean in if and while statements

2013-02-11 Thread 88888 Dihedral
Rick Johnson於 2013年2月11日星期一UTC+8下午9時13分58秒寫道: On Monday, February 11, 2013 6:40:23 AM UTC-6, Chris Angelico wrote: [...] Or doing what you were pointing and laughing at Pike for, and using two-symbol delimiters. You could even make it majorly logical: list_ = [[ 1, 2, 3 ]]

Re: Python recv loop

2013-02-11 Thread Ihsan Junaidi Ibrahim
On Feb 11, 2013, at 11:24 PM, Chris Angelico ros...@gmail.com wrote: On Tue, Feb 12, 2013 at 2:11 AM, MRAB pyt...@mrabarnett.plus.com wrote: I probably wouldn't make it fixed length. I'd have the length in decimal followed by, say, \n. Or even followed by any non-digit. Chances are your

Re: Python recv loop

2013-02-11 Thread Chris Angelico
On Tue, Feb 12, 2013 at 12:41 PM, Ihsan Junaidi Ibrahim ih...@grep.my wrote: On Feb 11, 2013, at 11:24 PM, Chris Angelico ros...@gmail.com wrote: On Tue, Feb 12, 2013 at 2:11 AM, MRAB pyt...@mrabarnett.plus.com wrote: I probably wouldn't make it fixed length. I'd have the length in decimal

Re: Python recv loop

2013-02-11 Thread Roy Smith
In article mailman.1655.1360594595.2939.python-l...@python.org, Ihsan Junaidi Ibrahim ih...@grep.my wrote: I'm running JSON for my application messaging protocol but with JSON and python default unordered dict, there's no guarantee if I put in the length key in the JSON message, it will be

Re: Import redirects

2013-02-11 Thread Isaac To
On Mon, Feb 11, 2013 at 8:27 PM, Oscar Benjamin oscar.j.benja...@gmail.comwrote: On 11 February 2013 06:50, Isaac To isaac...@gmail.com wrote: Except one thing: it doesn't really work. If I `import foo.baz.mymod` now, and if in bar.baz.mymod there is a statement `import bar.baz.depmod`,

Re: Python recv loop

2013-02-11 Thread MRAB
On 2013-02-12 02:20, Chris Angelico wrote: On Tue, Feb 12, 2013 at 12:41 PM, Ihsan Junaidi Ibrahim ih...@grep.my wrote: On Feb 11, 2013, at 11:24 PM, Chris Angelico ros...@gmail.com wrote: On Tue, Feb 12, 2013 at 2:11 AM, MRAB pyt...@mrabarnett.plus.com wrote: I probably wouldn't make it

Re: Implicit conversion to boolean in if and while statements

2013-02-11 Thread Rick Johnson
On Monday, February 11, 2013 7:35:23 AM UTC-6, Chris Angelico wrote: On Tue, Feb 12, 2013 at 12:13 AM, Rick Johnson wrote: I am vehemently against using more than one opening seq char and one closing seq char. ... we could use start and end tags like: set{1,2,3}set where set{ and

Re: Implicit conversion to boolean in if and while statements

2013-02-11 Thread Rick Johnson
On Monday, February 11, 2013 7:52:24 AM UTC-6, Chris Angelico wrote: [...] But my statement wasn't based on my own knowledge of the stdlib, but rather on this: On Sat, Feb 9, 2013 at 6:58 AM, Rick Johnson wrote: I'm a bit unnerved by the sum function. Summing a sequence only makes sense

Re: LangWart: Method congestion from mutate multiplicty

2013-02-11 Thread Rick Johnson
On Monday, February 11, 2013 7:27:30 AM UTC-6, Chris Angelico wrote: So... flatten([None, 23, [1, 2, 3], (2, 3), [spam, ham]]) would return [None, 23, 1, 2, 3, (2, 3), spam, ham] I think that's even more unexpected. Why? Are you over-analyzing? Show me a result that /does/ make you

how to call shell?

2013-02-11 Thread contro opinion
import os os.system(i=3) 0 os.system(echo $i) 0 why i can't get the value of i ? -- http://mail.python.org/mailman/listinfo/python-list

Re: Implicit conversion to boolean in if and while statements

2013-02-11 Thread Mark Janssen
On Fri, Feb 8, 2013 at 9:48 AM, Rick Johnson rantingrickjohn...@gmail.com wrote: On Friday, February 8, 2013 9:16:42 AM UTC-6, Steven D'Aprano wrote: Rick Johnson wrote: Just because /everything/ in Python is an object does not mean that Python is 100% OOP. The whole idea of make everything

Re: LangWart: Method congestion from mutate multiplicty

2013-02-11 Thread Mark Janssen
On Mon, Feb 11, 2013 at 8:55 PM, Rick Johnson rantingrickjohn...@gmail.com wrote: On Monday, February 11, 2013 7:27:30 AM UTC-6, Chris Angelico wrote: So... flatten([None, 23, [1, 2, 3], (2, 3), [spam, ham]]) would return [None, 23, 1, 2, 3, (2, 3), spam, ham] I think that's even more

Re: call shell from python

2013-02-11 Thread Chris Rebert
On Mon, Feb 11, 2013 at 9:13 PM, contro opinion contropin...@gmail.com wrote: import os os.system(i=3) 0 os.system(echo $i) 0 how can i get the value of i? Your example is too heavily contrived for me to give a much more specific/useful answer than use the `subprocess` module:

Re: how to call shell?

2013-02-11 Thread Tim Roberts
contro opinion contropin...@gmail.com wrote: import os os.system(i=3) 0 os.system(echo $i) 0 why i can't get the value of i ? Each invocation of os.system creates a brand new shell that starts, runs, and terminates. Your first command adds a variable i to the environment for that shell,

Re: Implicit conversion to boolean in if and while statements

2013-02-11 Thread Chris Angelico
On Tue, Feb 12, 2013 at 12:06 PM, 8 Dihedral dihedral88...@googlemail.com wrote: A permanently mutated list is a tuple of constant objects. I nominate this line as bemusing head-scratcher of the week. ChrisA -- http://mail.python.org/mailman/listinfo/python-list

Awsome Python - chained exceptions

2013-02-11 Thread Steven D'Aprano
As an antidote to the ill-informed negativity of Ranting Rick's illusionary PyWarts, I thought I'd present a few of Python's more awesome features, starting with exception contexts. If you've ever written an exception handler, you've probably written a *buggy* exception handler: def

[issue16997] subtests

2013-02-11 Thread holger krekel
holger krekel added the comment: On Sun, Feb 10, 2013 at 12:41 PM, Antoine Pitrou rep...@bugs.python.orgwrote: Antoine Pitrou added the comment: Please don't commit I think we still need a discussion as to whether subtests or paramaterized tests are a better approach. I certainly don't

[issue16997] subtests

2013-02-11 Thread holger krekel
holger krekel added the comment: On Sun, Feb 10, 2013 at 12:43 PM, Nick Coghlan rep...@bugs.python.orgwrote: Nick Coghlan added the comment: You can use subtests to build parameterized tests, you can't use parameterized tests to build subtests. I doubt you can implement parametrized tests

[issue4591] 32-bits unsigned user/group identifier

2013-02-11 Thread Mark Dickinson
Mark Dickinson added the comment: Hmm; good point. Well, +1 to the functionality, anyway; I'll leave the discussion about the name. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue4591

[issue17179] TypeError: type() takes 1 or 3 arguments

2013-02-11 Thread Chris Withers
New submission from Chris Withers: from types import new_class from datetime import datetime new_class('tdatetime', (datetime, ), kwds={'foo':'bar'}) Traceback (most recent call last): File console, line 1, in module File /src/Python-3.3.0/Lib/types.py, line 52, in new_class return

[issue17180] shutil copy* unsafe on POSIX - they preserve setuid/setgit bits

2013-02-11 Thread Milko Krachounov
New submission from Milko Krachounov: When copying the mode of a file with copy, copy2, copymode, copystat or copytree, all permission bits are copied (including setuid and setgit), but the owner of the file is not. This can be used for privilege escalation. An example: -rwSr--r-- 1 milko

[issue4591] 32-bits unsigned user/group identifier

2013-02-11 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: There is a problem with test_pwd on 64-bit platform. It expects KeyError on pwd.getpwuid(sys.maxsize). Actually the test is not looks robust. On 32-bit platform sys.maxsize = 2**31-1 2**32 and this value only by chance was not in the user database. On

[issue17159] Remove explicit type check from inspect.Signature.from_function()

2013-02-11 Thread Nick Coghlan
Nick Coghlan added the comment: On Mon, Feb 11, 2013 at 11:46 AM, Terry J. Reedy rep...@bugs.python.org wrote: I am also puzzled by the 'from None' part in + raise TypeError('{!r}' is not a Python function.format(func)) from None While I remember that being in the pydev discussion and while

[issue16997] subtests

2013-02-11 Thread Antoine Pitrou
Antoine Pitrou added the comment: what if there are 500 subtests in a loop and you don't want 500 failures to be registered for that test case? Parametered tests have the same issue. In this case you simply don't use subtests or test cases. On the other hand, the issue doesn't exist in most

[issue17181] SSLContext.set_servername_callback should be able to set argument

2013-02-11 Thread Daniel Black
New submission from Daniel Black: I think my original implementation of the SNI callback to see a original sslcontext was wrong. It would be much more useful for the SSLContext.set_servername_callback to take a callable and an object as an argument. This would allow constructs like the

[issue10852] SSL/TLS sni use in smtp, pop, imap, nntp, ftp client libs by default

2013-02-11 Thread Daniel Black
Daniel Black added the comment: Ack. Have fix. Simple if self.certfile or self.keyfile: test added before load_cert_chain. part way through developing test. Thinking #17181 would help. -- ___ Python tracker rep...@bugs.python.org

[issue17052] unittest discovery should use self.testLoader

2013-02-11 Thread Michael Foord
Michael Foord added the comment: I think you're right! Thanks. -- assignee: - michael.foord resolution: fixed - status: closed - open ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17052

[issue17152] Array module should support boolean natively

2013-02-11 Thread Jesús Cea Avión
Jesús Cea Avión added the comment: we have a -1, so I close this as rejected. I still think it is a valuable idea to pursuit. -- resolution: - rejected status: open - closed ___ Python tracker rep...@bugs.python.org

[issue17152] Array module should support boolean natively

2013-02-11 Thread Jesús Cea Avión
Changes by Jesús Cea Avión j...@jcea.es: -- stage: - committed/rejected ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17152 ___ ___

[issue17044] Implement PEP 422: Simple class initialisation hook

2013-02-11 Thread Florent Xicluna
Changes by Florent Xicluna florent.xicl...@gmail.com: -- nosy: +flox ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17044 ___ ___ Python-bugs-list

[issue17052] unittest discovery should use self.testLoader

2013-02-11 Thread Roundup Robot
Roundup Robot added the comment: New changeset ece0a2e6b08e by Michael Foord in branch '2.7': Correction to issue 17052 fix http://hg.python.org/cpython/rev/ece0a2e6b08e New changeset 867763eb6985 by Michael Foord in branch '3.2': Correction to issue 17052 fix

[issue17182] signal.default_int_handler should set signal number on the raised exception

2013-02-11 Thread Antoine Pitrou
New submission from Antoine Pitrou: Having a dedicated optional attribute on KeyboardInterrupt receiving the signal number would be useful in certain circumstances, for example if you want to propagate the signal to a child process. -- components: Extension Modules messages: 181894

[issue17063] assert_called_with could be more powerful if it allowed placeholders

2013-02-11 Thread Michael Foord
Michael Foord added the comment: I still don't particularly like the idea of the assert_* methods returning something. If the call args tuples had args and kwargs attributes, for which there are outstanding feature requests, then you could simply do: my_mock(1, someobj(), bar=someotherobj())

[issue17064] Fix sporadic buildbot failures for test_mailbox

2013-02-11 Thread R. David Murray
R. David Murray added the comment: Thanks, Jeremy. -- resolution: - fixed stage: - committed/rejected status: open - closed type: - behavior versions: +Python 2.7, Python 3.2 -Python 3.5 ___ Python tracker rep...@bugs.python.org

[issue17181] SSLContext.set_servername_callback should be able to set argument

2013-02-11 Thread Antoine Pitrou
Antoine Pitrou added the comment: This would allow constructs like the following where self can be used within the callback. Example: def cb_sni(ssl_sock, server_name, self): self.sniname = server_name self.context.set_servername_callback(cb_sni, self) The

[issue4591] 32-bits unsigned user/group identifier

2013-02-11 Thread Eric V. Smith
Eric V. Smith added the comment: +1 for PyIndex_AsLong() -- nosy: +eric.smith ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue4591 ___ ___

[issue17064] Fix sporadic buildbot failures for test_mailbox

2013-02-11 Thread Roundup Robot
Roundup Robot added the comment: New changeset bbeff2958cc5 by R David Murray in branch '3.2': #17064: fix sporadic permission errors in test_mailbox on windows. http://hg.python.org/cpython/rev/bbeff2958cc5 New changeset 3e3915cbfde3 by R David Murray in branch '3.3': Merge: #17064: fix

[issue9874] Message.attach() loses empty attachments

2013-02-11 Thread R. David Murray
R. David Murray added the comment: Lacking a reproducer, there's not much we can do here, so closing. -- resolution: - works for me stage: test needed - committed/rejected status: open - closed ___ Python tracker rep...@bugs.python.org

[issue17171] email.encoders.encode7or8bit does not work with binary data

2013-02-11 Thread R. David Murray
Changes by R. David Murray rdmur...@bitdance.com: -- type: - behavior ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17171 ___ ___

[issue15767] add ModuleNotFoundError

2013-02-11 Thread Barry A. Warsaw
Changes by Barry A. Warsaw ba...@python.org: -- nosy: +barry ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue15767 ___ ___ Python-bugs-list mailing

[issue15767] add ModuleNotFoundError

2013-02-11 Thread Barry A. Warsaw
Barry A. Warsaw added the comment: For me, it mostly comes down to whether end-users are expected to see such errors generally or not. We see ImportErrors all the time, and they are clearly errors. If we're expected to see and deal with MNF, and if in such cases it's generally considered an

[issue16935] unittest should understand SkipTest at import time during test discovery

2013-02-11 Thread Zachary Ware
Zachary Ware added the comment: Sure can. With a little luck, I'll have the patch ready later today; with less luck it'll be sometime later this week. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16935

[issue17183] Small enhancements to Lib/_markupbase.py

2013-02-11 Thread Guido Reina
New submission from Guido Reina: In the file: Lib/_markupbase.py, function: _parse_doctype_element there is: if '' in rawdata[j:]: return rawdata.find(, j) + 1 rawdata[j:] is being scanned twice. It would be better to do: pos = rawdata.find(, j) if pos != -1: return pos + 1 Same

[issue17183] Small enhancements to Lib/_markupbase.py

2013-02-11 Thread Ezio Melotti
Changes by Ezio Melotti ezio.melo...@gmail.com: -- assignee: - ezio.melotti components: +Library (Lib) nosy: +ezio.melotti stage: - needs patch versions: -Python 2.6, Python 2.7, Python 3.1, Python 3.2, Python 3.3, Python 3.5 ___ Python tracker

[issue17183] Small enhancements to Lib/_markupbase.py

2013-02-11 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: if '' in rawdata[j:]: return rawdata.find(, j) + 1 See issue17170 for this idiom. -- nosy: +serhiy.storchaka ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17183

[issue17171] email.encoders.encode7or8bit does not work with binary data

2013-02-11 Thread Roundup Robot
Roundup Robot added the comment: New changeset f83581135ec4 by R David Murray in branch '3.2': #17171: fix email.encoders.encode_7or8bit when applied to binary data. http://hg.python.org/cpython/rev/f83581135ec4 New changeset cabcddbed377 by R David Murray in branch '3.3': Merge: #17171: fix

[issue17171] email.encoders.encode7or8bit does not work with binary data

2013-02-11 Thread R. David Murray
R. David Murray added the comment: Since this was straightforwardly similar to the issue 16564 fix I didn't bother with a review. The 2.7 commit is backporting the behavior-confirming test, just for thoroughness. -- resolution: - fixed stage: needs patch - committed/rejected status:

  1   2   >