Re: InvalidResponseError: headers must be str

2011-12-30 Thread Steven D'Aprano
On Fri, 30 Dec 2011 20:58:10 -0800, Niklas Rosencrantz wrote: > I'm upgrading from python 2.5 to python 2.7 and then I'm starting to get > this error: > > InvalidResponseError: headers must be str Please show the ENTIRE traceback, not just the error message. The traceback is very informative: i

dict_to_xml

2011-12-30 Thread Emeka
Hello All, I have a dictionary object I would like to convert to xml. Could some assist with the link to libs to use? Or good examples. Regards, Janus -- *Satajanus Nig. Ltd * -- http://mail.python.org/mailman/listinfo/python-list

InvalidResponseError: headers must be str

2011-12-30 Thread Niklas Rosencrantz
I'm upgrading from python 2.5 to python 2.7 and then I'm starting to get this error: InvalidResponseError: headers must be str I think it is because somewhere my HTTP headers are cast to unicode instead of string but I can't find where in the code? The example code I'm trying to upgrade to pyt

Re: Generating sin/square waves sound

2011-12-30 Thread K Richard Pixley
On 12/29/11 23:17 , Paulo da Silva wrote: Hi, Sorry if this is a FAQ, but I have googled and didn't find any satisfatory answer. Is there a simple way, preferably multiplataform (or linux), of generating sinusoidal/square waves sound in python? Thanks for any answers/suggestions. I just poste

Re: Which library for audio playback ?

2011-12-30 Thread K Richard Pixley
On 12/29/11 05:55 , Jérôme wrote: I'm writing a small application that plays sound through the speakers. The sounds are juste sine waves of arbitrary frequency I create in the code, not sample .wav files. I didn't expect the choice for an audio library to be that complicated. There are several l

Re: mutually exclusive arguments to a constructor

2011-12-30 Thread Chris Angelico
On Sat, Dec 31, 2011 at 10:39 AM, Roy Smith wrote: > In article , >  Chris Angelico wrote: > >> You know a Python programmer's been at your C++ code when it opens: >> #define class struct > > Why stop there? > > #define private public Probably yeah, do both. Anyway, life's so much easier when yo

Re: mutually exclusive arguments to a constructor

2011-12-30 Thread Roy Smith
In article , Chris Angelico wrote: > On Sat, Dec 31, 2011 at 10:24 AM, Roy Smith wrote: > > "But!", some C++/Java type bondage addicts might cry, "there's nothing > > to prevent somebody from creating a DirectionIndicatingThingie directly, > > bypassing the factory functions.  There's no way to

Re: mutually exclusive arguments to a constructor

2011-12-30 Thread Chris Angelico
On Sat, Dec 31, 2011 at 10:24 AM, Roy Smith wrote: > "But!", some C++/Java type bondage addicts might cry, "there's nothing > to prevent somebody from creating a DirectionIndicatingThingie directly, > bypassing the factory functions.  There's no way to make the constructor > private!".  To which t

Re: mutually exclusive arguments to a constructor

2011-12-30 Thread Roy Smith
In article , Adam Funk wrote: > (Warning: this question obviously reflects the fact that I am more > accustomed to using Java than Python.) > > Suppose I'm creating a class that represents a bearing or azimuth, > created either from a string of traditional bearing notation > ("N24d30mE") or fro

Re: mutually exclusive arguments to a constructor

2011-12-30 Thread Steven D'Aprano
On Fri, 30 Dec 2011 21:18:29 +, Jason Friedman wrote: > class azimuth: > def __init__(self, bearing, heading): It is conventional, and recommended, to use an initial capital letter for classes. (Yes, Python built-ins violate that rule, and indeed so do some non-built-ins.) See PEP 8 for

Re: mutually exclusive arguments to a constructor

2011-12-30 Thread Steven D'Aprano
On Fri, 30 Dec 2011 20:40:16 +, Adam Funk wrote: > (Warning: this question obviously reflects the fact that I am more > accustomed to using Java than Python.) > > Suppose I'm creating a class that represents a bearing or azimuth, > created either from a string of traditional bearing notation

Re: How to get function string name from i-th stack position?

2011-12-30 Thread Ian Kelly
On Fri, Dec 30, 2011 at 11:43 AM, dmitrey wrote: > Thank you. And what should I do to get function by itself instead of > its string name, e.g. I want to know does this function is my_func or > any other? For example, I would like to check is this function Python > sum(), or maybe numpy.sum(), or

Re: mutually exclusive arguments to a constructor

2011-12-30 Thread Jason Friedman
> Suppose I'm creating a class that represents a bearing or azimuth, > created either from a string of traditional bearing notation > ("N24d30mE") or from a number indicating the angle in degrees as > usually measured in trigonometry (65.5, measured counter-clockwise > from the x-axis).  The class

Re: mutually exclusive arguments to a constructor

2011-12-30 Thread Arnaud Delobelle
On 30 December 2011 20:40, Adam Funk wrote: > (Warning: this question obviously reflects the fact that I am more > accustomed to using Java than Python.) > > Suppose I'm creating a class that represents a bearing or azimuth, > created either from a string of traditional bearing notation > ("N24d30

Re: mutually exclusive arguments to a constructor

2011-12-30 Thread Mel Wilson
Adam Funk wrote: > (Warning: this question obviously reflects the fact that I am more > accustomed to using Java than Python.) > > Suppose I'm creating a class that represents a bearing or azimuth, > created either from a string of traditional bearing notation > ("N24d30mE") or from a number indi

Re: mutually exclusive arguments to a constructor

2011-12-30 Thread Günther Dietrich
Adam Funk wrote: >Suppose I'm creating a class that represents a bearing or azimuth, >created either from a string of traditional bearing notation >("N24d30mE") or from a number indicating the angle in degrees as >usually measured in trigonometry (65.5, measured counter-clockwise >from the x-axis

mutually exclusive arguments to a constructor

2011-12-30 Thread Adam Funk
(Warning: this question obviously reflects the fact that I am more accustomed to using Java than Python.) Suppose I'm creating a class that represents a bearing or azimuth, created either from a string of traditional bearing notation ("N24d30mE") or from a number indicating the angle in degrees as

Re: Doing a HTTP DELETE operation with urllib2?

2011-12-30 Thread Dave Angel
On 12/30/2011 03:37 PM, Steven D'Aprano wrote: On Fri, 30 Dec 2011 10:57:06 -0800, Roy Smith wrote: Ah, cool. I didn't know you could do that. Thanks. Who are you talking to, and what is "that"? Replies with no context are somewhat less than useful. It might have made sense in your head whe

Re: Doing a HTTP DELETE operation with urllib2?

2011-12-30 Thread Steven D'Aprano
On Fri, 30 Dec 2011 10:57:06 -0800, Roy Smith wrote: > Ah, cool. I didn't know you could do that. Thanks. Who are you talking to, and what is "that"? Replies with no context are somewhat less than useful. It might have made sense in your head when you wrote the reply, but to those reading, it

Re: Doing a HTTP DELETE operation with urllib2?

2011-12-30 Thread Roy Smith
Ah, cool. I didn't know you could do that. Thanks. -- http://mail.python.org/mailman/listinfo/python-list

Re: How to get function string name from i-th stack position?

2011-12-30 Thread dmitrey
On Dec 30, 8:35 pm, Tim Chase wrote: > On 12/30/11 11:51, dmitrey wrote: > > > how to get string name of a function that is n levels above > > the current Python interpreter position? > > Use the results of traceback.extract_stack() > >    from traceback import extract_stack >    def one(x): >    

Re: How to get function string name from i-th stack position?

2011-12-30 Thread Tim Chase
On 12/30/11 11:51, dmitrey wrote: how to get string name of a function that is n levels above the current Python interpreter position? Use the results of traceback.extract_stack() from traceback import extract_stack def one(x): print "one", x stk = extract_stack() for mod, line

Creating a binary only python distribution of a C extension module and including some additional python and c files in it

2011-12-30 Thread akhilesh singhania
Hi, I have a extension module in C which I want to distribute in binary format, ideally an rpm. Additionally, I want to include some python files (examples on how to use the extension module) and source for a library the module dynamically links to (c,h, and make files). How do I specify the exam

Re: Doing a HTTP DELETE operation with urllib2?

2011-12-30 Thread Douglas Landgraf
Hi, On 12/30/2011 12:01 PM, Roy Smith wrote: Is there some way to make urllib2.urlopen() perform a DELETE instead of a GET or POST? I'm hoping I don't have to dip way down into httplib. I've got an application test framework built on top of urllib2. It makes heavy use of HTTPCookieProces

Re: pickling instances of metaclass generated classes

2011-12-30 Thread Ian Kelly
On Fri, Dec 30, 2011 at 9:51 AM, lars van gemerden wrote: > I still wonder whether it might be easier to add the class to the > namespace. Can anyone help me with that? from mypackage import mymodule setattr(mymodule, myclass.__name__, myclass) -- http://mail.python.org/mailman/listinfo/python-

Doing a HTTP DELETE operation with urllib2?

2011-12-30 Thread Roy Smith
Is there some way to make urllib2.urlopen() perform a DELETE instead of a GET or POST? I'm hoping I don't have to dip way down into httplib. I've got an application test framework built on top of urllib2. It makes heavy use of HTTPCookieProcessor. If I need to use the httplib calls directly

Re: pickling instances of metaclass generated classes

2011-12-30 Thread lars van gemerden
On Dec 30, 4:56 pm, lars van gemerden wrote: > On Dec 30, 12:16 pm, lars van gemerden wrote: > > > > > > > > > > > On Dec 29, 8:55 pm, Ian Kelly wrote: > > > > On Thu, Dec 29, 2011 at 2:55 AM, lars van gemerden > > > wrote: > > > > > Hello, > > > > > Can someone help me with the following: > >

Re: pickling instances of metaclass generated classes

2011-12-30 Thread lars van gemerden
On Dec 30, 12:16 pm, lars van gemerden wrote: > On Dec 29, 8:55 pm, Ian Kelly wrote: > > > > > > > > > > > On Thu, Dec 29, 2011 at 2:55 AM, lars van gemerden > > wrote: > > > > Hello, > > > > Can someone help me with the following: > > > > I am using metaclasses to make classes and these classe

Re: Is python.org down?

2011-12-30 Thread vikash agrawal
hi Everyone, it seems http://in.pycon.org/2011/ is also down :( Regards Vikash Agrawal -- sent via HTC Sensation -- http://mail.python.org/mailman/listinfo/python-list

Re: Is python.org down?

2011-12-30 Thread tistje
On 30 dec, 14:48, Chris Angelico wrote: > On Sat, Dec 31, 2011 at 12:21 AM, Mario Menezes wrote: > > Hi, > > >  I´m trying to access pypi.python.org as well aswww.python.organd none of > > them is up? > > >  Anybody else having problems with python.org today? Is there a scheduled > > downtime?

Re: Is python.org down?

2011-12-30 Thread python
A good tool for determining whether a site is down or just unavailable to you: http://downorisitjustme.com Malcolm -- http://mail.python.org/mailman/listinfo/python-list

Re: Is python.org down?

2011-12-30 Thread Mario Menezes
Yeah! www.python.org is up now. pypi.python.org still with problems (502 Bad Gateway). will wait couple time. somebody seems to be working on this. thanks. -- http://mail.python.org/mailman/listinfo/python-list

Re: Is python.org down?

2011-12-30 Thread Chris Angelico
On Sat, Dec 31, 2011 at 12:21 AM, Mario Menezes wrote: > Hi, > >  I´m trying to access pypi.python.org as well as www.python.org and none of > them is up? > >  Anybody else having problems with python.org today? Is there a scheduled > downtime? > >  Thanks Appears to be up now, for me at least.

Re: Is python.org down?

2011-12-30 Thread Jérôme
Fri, 30 Dec 2011 05:39:37 -0800 (PST) tistje a écrit: > On 30 dec, 14:21, Mario Menezes wrote: > > Hi, > > > >  I´m trying to access pypi.python.org as well as www.python.org and none > > of them is up? > > > >   Anybody else having problems with python.org today? Is there a > > scheduled downtim

Re: Is python.org down?

2011-12-30 Thread tistje
On 30 dec, 14:21, Mario Menezes wrote: > Hi, > >  I´m trying to access pypi.python.org as well as www.python.org and none of > them is up? > >   Anybody else having problems with python.org today? Is there a scheduled > downtime? > >   Thanks > > Mario Menezes > Brazil Seems like it is down ...

Is python.org down?

2011-12-30 Thread Mario Menezes
Hi, I´m trying to access pypi.python.org as well as www.python.org and none of them is up? Anybody else having problems with python.org today? Is there a scheduled downtime? Thanks Mario Menezes Brazil -- http://mail.python.org/mailman/listinfo/python-list

Re: pickling instances of metaclass generated classes

2011-12-30 Thread Peter Otten
lars van gemerden wrote: > On Dec 29, 8:55 pm, Ian Kelly wrote: >> On Thu, Dec 29, 2011 at 2:55 AM, lars van gemerden >> wrote: >> >> > Hello, >> >> > Can someone help me with the following: >> >> > I am using metaclasses to make classes and these classes to make >> > instances. Now I want to us

Re: Generating sin/square waves sound

2011-12-30 Thread mblume
Am Fri, 30 Dec 2011 07:17:13 + schrieb Paulo da Silva: > Hi, > Sorry if this is a FAQ, but I have googled and didn't find any > satisfatory answer. > > Is there a simple way, preferably multiplataform (or linux), of > generating sinusoidal/square waves sound in python? > > Thanks for any ans

Re: pickling instances of metaclass generated classes

2011-12-30 Thread lars van gemerden
On Dec 29, 8:55 pm, Ian Kelly wrote: > On Thu, Dec 29, 2011 at 2:55 AM, lars van gemerden > wrote: > > > Hello, > > > Can someone help me with the following: > > > I am using metaclasses to make classes and these classes to make > > instances. Now I want to use multiprocessing, which needs to pi

Re: importing MySQLdb

2011-12-30 Thread Ned Deily
In article <4efb9d6d.3080...@gmail.com>, Dilara Ally wrote: > I'm trying to import the MySQLdb for python. I downloaded the proper > setuptools egg (ver2.7) for a Mac with OSX10.6 > > I then downloaded the MySQL-python-1.2.3 and ran the following commands > > python setup.py build > sudo pyth

Re: Generating sin/square waves sound

2011-12-30 Thread Dave Angel
On 12/30/2011 02:17 AM, Paulo da Silva wrote: Hi, Sorry if this is a FAQ, but I have googled and didn't find any satisfatory answer. Is there a simple way, preferably multiplataform (or linux), of generating sinusoidal/square waves sound in python? Thanks for any answers/suggestions. If you're

Re: pickling instances of metaclass generated classes

2011-12-30 Thread lars van gemerden
On Dec 29, 8:55 pm, Ian Kelly wrote: > On Thu, Dec 29, 2011 at 2:55 AM, lars van gemerden > wrote: > > > Hello, > > > Can someone help me with the following: > > > I am using metaclasses to make classes and these classes to make > > instances. Now I want to use multiprocessing, which needs to pi

Re: Generating sin/square waves sound

2011-12-30 Thread 88888 Dihedral
Please check PYGAME and Simple Directmedia library. Python is used as the director like role and functions in SDL do most of the jobs in Pygame. -- http://mail.python.org/mailman/listinfo/python-list