Re: Question regarding DNS resolution in urllib2
On 15-Jun-2011, at 6:13 AM, Chris Angelico wrote: On Wed, Jun 15, 2011 at 4:34 AM, saurabh verma nitw.saur...@gmail.com wrote: hi , I trying to use urllib2 in my script , but the problem is lets say a domains resolves to multiple IPs , If the URL is served by plain http , I can add “Host: domain” header and check whether all IPs are returning proper responses or not , but in case of https , I have to trust on my local machines dns resolver and I can’t apply host header in the request . Regarding Host: headers, experimentation showed that urllib2 did indeed send one (I tested using Python 2.7.1 on Windows, talking to a snooping HTTPS server running on a Linux box beside me - source code available if you're curious, but it's not Python). Ok thats informative , thanks :) . But my problem lies in testing https based virtual served by nginx when the domain is load balanced by DNS . Example , I have “http://something.com” and “https://something.com” both served by two servers and something.com resolves to two ips IPA,IPB . lets say i want to test both servers on http i can do the following curl “http://IPA/” -H “Host: something.com curl “http://IPB/” -H “Host: something.com” But in the case of https , I can do above because https handshake is based on the domain i am trying to connect , so lets say I want to following inside a python script using libcurl2 but without touching /etc/hosts , curl “https://something.com” , now something.com will try to connect to either IPA or IPB which I don’t have control over , I know internally it must be calling a DNS resolver libarary of python , I want to control over that , may be libcurl2 exposing a function to do some DNS altering . Is it worth hacking libcurl2 code for something like , Also i’m just not more than 1 week exprienced in python , but i do enjoy your mailing list , awesome participation . Thanks , Saurabh Verma -- http://mail.python.org/mailman/listinfo/python-list
Re: Question regarding DNS resolution in urllib2
On Wed, Jun 15, 2011 at 4:23 PM, saurabh verma nitw.saur...@gmail.com wrote: But in the case of https , I can do above because https handshake is based on the domain i am trying to connect , so lets say I want to following inside a python script using libcurl2 but without touching /etc/hosts , curl “https://something.com” , now something.com will try to connect to either IPA or IPB which I don’t have control over , I know internally it must be calling a DNS resolver libarary of python , I want to control over that , may be libcurl2 exposing a function to do some DNS altering . If you edit your hosts file, it will affect where something.com points - you can force it to be IPA and then test, then force it to IPB and test. You'll still be downloading https://something.com so the HTTPS handshake should work exactly the same way. Chris Angelico -- http://mail.python.org/mailman/listinfo/python-list
Re: Keyboard Layout: Dvorak vs Colemak: is it Worthwhile to Improve the Dvorak Layout?
Dennis Lee Bieber wlfr...@ix.netcom.com wrote: On Sun, 12 Jun 2011 21:30:43 -0700, Tim Roberts t...@probo.com declaimed the following in gmane.comp.python.general: More than that, any layout more efficient than QWERTY is practically meaningless. The whole intentional inefficiency thing in the design of the QWERTY layout is an urban legend. Oh, there was an inefficiency in QWERTY -- but it only applies to fully manual typewriters, in which some of the more common letters were placed under the weakest fingers -- to slow down key strokes enough to reduce jamming multiple type blocks That's what I was referring to. That's a very common belief, but it's nonsense. -- Tim Roberts, t...@probo.com Providenza Boekelheide, Inc. -- http://mail.python.org/mailman/listinfo/python-list
Re: Question regarding DNS resolution in urllib2
If you edit your hosts file, it will affect where something.com points - you can force it to be IPA and then test, then force it to IPB and test. You'll still be downloading https://something.com so the HTTPS handshake should work exactly the same way. there are issues with editing /etc/hosts , what if i don't have sudo access on the target server ? I need a way out programmatically to fix this problem . -- http://mail.python.org/mailman/listinfo/python-list
Python for Web
Is Python only for server side? -- http://mail.python.org/mailman/listinfo/python-list
R: Leo 4.9 b4 released
great! I like much leo ^___^ -- http://mail.python.org/mailman/listinfo/python-list
Re: Question regarding DNS resolution in urllib2
On Wed, Jun 15, 2011 at 5:50 PM, saurabh verma nitw.saur...@gmail.com wrote: If you edit your hosts file, it will affect where something.com points - you can force it to be IPA and then test, then force it to IPB and test. You'll still be downloading https://something.com so the HTTPS handshake should work exactly the same way. there are issues with editing /etc/hosts , what if i don't have sudo access on the target server ? I need a way out programmatically to fix this problem You don't need to edit it on the server; just use any handy computer. You need only tinker with the configuration on the client, not the server. Chris Angelico -- http://mail.python.org/mailman/listinfo/python-list
Re: Keyboard Layout: Dvorak vs Colemak: is it Worthwhile to Improve the Dvorak Layout?
On Wed, Jun 15, 2011 at 5:16 PM, Tim Roberts t...@probo.com wrote: Dennis Lee Bieber wlfr...@ix.netcom.com wrote: Oh, there was an inefficiency in QWERTY -- but it only applies to fully manual typewriters, in which some of the more common letters were placed under the weakest fingers -- to slow down key strokes enough to reduce jamming multiple type blocks That's what I was referring to. That's a very common belief, but it's nonsense. Competing rumour: The layout was designed such that typewriter could be typed out using only the top row, to improve demo speed by a factor of three. ChrisA -- http://mail.python.org/mailman/listinfo/python-list
Subprocess Startup Error
I just installed Python 3.2 and when starting the GUI from the start menu I get a Subprocess Startup Error message : IDLE's subprocess didn't make connection. Either IDLE can't start a subprocess or personal firewall software is blocking the connection. I'm running XP (SP3) and have added python to windows firewall exceptions and then turned off the firewall all together to no avail. I was running Python 2.6 previously and never had this problem. Any suggestions would be greatly appreciated. Dan attachment: winmail.dat-- http://mail.python.org/mailman/listinfo/python-list
Re: Question regarding DNS resolution in urllib2
You don't need to edit it on the server; just use any handy computer. You need only tinker with the configuration on the client, not the server. Hmm true , Ok i can widen the problem statement but editing /etc/hosts still looks Ok for my test server . ( Thinking of putting this as a nagios plugin on the servers .. that will not be a viable right now ) Thanks chris. ~saurabh -- http://mail.python.org/mailman/listinfo/python-list
Re: Keyboard Layout: Dvorak vs Colemak: is it Worthwhile to Improve the Dvorak Layout?
On Wed, Jun 15, 2011 at 11:30, Chris Angelico ros...@gmail.com wrote: Competing rumour: The layout was designed such that typewriter could be typed out using only the top row, to improve demo speed by a factor of three. Utter nonsense. The QWERTY keyboard was - and this is verified fact - designed the way is was because the inventor's mother in law's initials were AS and his father is law was DF. The letter combinations JK and L; were his childrens' initials. -- Dotan Cohen http://gibberish.co.il http://what-is-what.com -- http://mail.python.org/mailman/listinfo/python-list
Re: Keyboard Layout: Dvorak vs Colemak: is it Worthwhile to Improve the Dvorak Layout?
On Wed, Jun 15, 2011 at 7:22 PM, Dotan Cohen dotanco...@gmail.com wrote: Utter nonsense. The QWERTY keyboard was - and this is verified fact - designed the way is was because the inventor's mother in law's initials were AS and his father is law was DF. The letter combinations JK and L; were his childrens' initials. He had a son called Harry ;emicolon? That's nearly as bad as Robert'); DROP TABLE Students; --. ChrisA -- http://mail.python.org/mailman/listinfo/python-list
Function within class and in modules
Hello sorry, I'm bit curious to understand what could be the difference to pack up a class for some number of functions in it and a simple module which I just import and use the similar functions? The only perspective that I think of is that class might instantiate a function several time. For my use I don't have multithread and mostly programs are sequencial. -- goto /dev/null -- http://mail.python.org/mailman/listinfo/python-list
Re: Python for Web
On Jun 15, 9:50 am, sidRo slacky2...@gmail.com wrote: Is Python only for server side? Is it a theoretical question or a practical one ?-) More seriously: except for the old proof-of-concept Grail browser, no known browser uses Python as a client-side scripting language. -- http://mail.python.org/mailman/listinfo/python-list
Re: Function within class and in modules
In article ita6nj$4j4$1...@speranza.aioe.org, TheSaint nob...@nowhere.net.no wrote: Hello sorry, I'm bit curious to understand what could be the difference to pack up a class for some number of functions in it and a simple module which I just import and use the similar functions? If all you have is a bunch of functions, just sticking them in a module is fine. The reason you would want to package them up as a class would be if there's some state that needs to be saved. Don't think of a class as a collection of methods, think of it as a hunk of data, and some methods which operate on that data. Looking at it another way, if you write a class and discover that none of the methods ever make any use of self, then what you probably really wanted to do was create a module to hold all those methods as top-level functions. -- http://mail.python.org/mailman/listinfo/python-list
Re: Keyboard Layout: Dvorak vs Colemak: is it Worthwhile to Improve the Dvorak Layout?
On Jun 15, 9:35 am, Dotan Cohen dotanco...@gmail.com wrote: On Wed, Jun 15, 2011 at 06:00, rusi rustompm...@gmail.com wrote: For keyboarding (in the piano/organ sense) the weakest finger is not the fifth/pinky but the fourth. Because for the fifth you will notice that the natural movement is to stiffen the finger and then use a slight outward arm-swing; for thumb, index and middle, they of course have their own strength. The fourth has neither advantage. IOW qwerty is not so bad as it could have been if it were qewrty (or asd was sad) Thank you rusi! Tell me, where can I read more about the advantages of each finger? Googling turns up nothing. My intention is to improved the Noah ergonomic keyboard layout. Thanks! Dont know how to answer that! I only have my experience to go by :-) If you've spent a childhood and many of your adult hours breaking your hands on Czerny http://en.wikipedia.org/wiki/Carl_Czerny and Hanon eg exercise 4 http://www.hanon-online.com/the-virtuoso-pianist/part-i/exercise-n-4/ you will come to similar conclusions. I should warn however that even for a modern electronic piano the action is larger and heavier than a typical (computer) keyboard and for a real/acoustic piano with a foot long slice of wood moved for each keystroke its probably an order of magnitude heavier. So its not exactly clear how much the experience of one carries over to the other -- http://mail.python.org/mailman/listinfo/python-list
integer to binary 0-padded
Hi there, I've been looking for 2 days for a way to convert integer to binary number 0-padded, nothing... I need to get numbers converted with a defined number of bits. For example on 8 bits 2 = 0010 I wrote the following: code #!/usr/bin/env python def int2binPadded(number, size): The purpose of this function is to convert integer number to binary number 0-padded. if type(number)!=int or number 0: raise ValueError, should be a positive integer if type(size)!=int: raise ValueError, should be an integer if number (2**size)-1: raise ValueError, number is too large # convert int to bin b = str(bin(number))[2:] if len(b) !=size: b = (size-len(b))*0+b return b if __name__ == __main__: import sys print int2binPadded(int(sys.argv[1]),int(sys.argv[2])) /code This satisfies my needs ! Though, what do you think about it ? Thank you for you remarks, Olivier -- http://mail.python.org/mailman/listinfo/python-list
Re: Keyboard Layout: Dvorak vs Colemak: is it Worthwhile to Improve the Dvorak Layout?
On Wed, Jun 15, 2011 at 15:19, rusi rustompm...@gmail.com wrote: Thank you rusi! Tell me, where can I read more about the advantages of each finger? Googling turns up nothing. My intention is to improved the Noah ergonomic keyboard layout. Thanks! Dont know how to answer that! I only have my experience to go by :-) If you've spent a childhood and many of your adult hours breaking your hands on Czerny http://en.wikipedia.org/wiki/Carl_Czerny and Hanon eg exercise 4 http://www.hanon-online.com/the-virtuoso-pianist/part-i/exercise-n-4/ you will come to similar conclusions. I should warn however that even for a modern electronic piano the action is larger and heavier than a typical (computer) keyboard and for a real/acoustic piano with a foot long slice of wood moved for each keystroke its probably an order of magnitude heavier. So its not exactly clear how much the experience of one carries over to the other Thanks. From testing small movements with my fingers I see that the fourth finger is in fact a bit weaker than the last finger, but more importantly, it is much less dexterous. Good to know! -- Dotan Cohen http://gibberish.co.il http://what-is-what.com -- http://mail.python.org/mailman/listinfo/python-list
Re: integer to binary 0-padded
Hi, Am 15.06.2011 14:29, schrieb Olivier LEMAIRE: Hi there, I've been looking for 2 days for a way to convert integer to binary number 0-padded, nothing... I need to get numbers converted with a defined number of bits. For example on 8 bits 2 = 0010 bin(2)[2:].zfill(8) Regards Daniel -- http://mail.python.org/mailman/listinfo/python-list
Re: Keyboard Layout: Dvorak vs Colemak: is it Worthwhile to Improve the Dvorak Layout?
On Jun 15, 5:32 pm, Dotan Cohen dotanco...@gmail.com wrote: Thanks. From testing small movements with my fingers I see that the fourth finger is in fact a bit weaker than the last finger, but more importantly, it is much less dexterous. Good to know! Most of the piano technique-icians emphasis, especially those of the last century like Hanon, was to cultivate 'independence' of the fingers. The main target of these attacks being the 4th finger. The number of potential-pianists who ruined their hands and lives chasing this holy grail is unknown -- http://mail.python.org/mailman/listinfo/python-list
Re: integer to binary 0-padded
On Wed, Jun 15, 2011 at 10:29 PM, Olivier LEMAIRE m.olivier.lema...@gmail.com wrote: b = str(bin(number))[2:] if len(b) !=size: b = (size-len(b))*0+b You don't need the str() there as bin() already returns a number. Here's a relatively trivial simplification - although it does make the code more cryptic: b = (size*0+bin(number)[2:])[-size:] After typing this up, I saw Daniel's post, which is rather better. Go with that one for zero-filling; mine's more general though, you can pad with other tokens. ChrisA -- http://mail.python.org/mailman/listinfo/python-list
Re: integer to binary 0-padded
Olivier LEMAIRE wrote: I've been looking for 2 days for a way to convert integer to binary number 0-padded, nothing... I need to get numbers converted with a defined number of bits. For example on 8 bits 2 = 0010 I wrote the following: b = str(bin(number))[2:] The result of bin() is already a string, no need to apply str(). if len(b) !=size: b = (size-len(b))*0+b b.zfill(size) can do that. Though, what do you think about it ? Here's another way (requires Python 2.7): {:0{}b}.format(42, 10) '101010' -- http://mail.python.org/mailman/listinfo/python-list
Re: integer to binary 0-padded
Thank you to all of you !! so finally, I can simply write : code #!/usr/bin/env python def int2binPadded(number, size): The purpose of this function is to convert integer number to binary number 0-padded. if type(number)!=int or number 0: raise ValueError, should be a positive integer if type(size)!=int: raise ValueError, should be an integer if number (2**size)-1: raise ValueError, number is too large # convert int to bin return bin(number)[2:].zfill(size) if __name__ == __main__: import sys print int2binPadded(int(sys.argv[1]),int(sys.argv[2])) /code -- http://mail.python.org/mailman/listinfo/python-list
Re: integer to binary 0-padded
On 06/15/2011 07:33 AM, Daniel Rentz wrote: Am 15.06.2011 14:29, schrieb Olivier LEMAIRE: Hi there, I've been looking for 2 days for a way to convert integer to binary number 0-padded, nothing... I need to get numbers converted with a defined number of bits. For example on 8 bits 2 = 0010 bin(2)[2:].zfill(8) Just to have in the thread (though the OP seems to be using 2.6 or later), the bin() function appears to have been added in 2.6 which is something I wish had been back-ported to 2.4 and 2.5 as I've been sufficiently stuck coding against older versions of Python to have (re)written a bin() function multiple times. Ah well. -tkc -- http://mail.python.org/mailman/listinfo/python-list
Re: integer to binary 0-padded
You're right, I use Python 2.6.6 -- http://mail.python.org/mailman/listinfo/python-list
Re: Function within class and in modules
On Jun 15, 7:57 am, TheSaint nob...@nowhere.net.no wrote: Hello sorry, I'm bit curious to understand what could be the difference to pack up a class for some number of functions in it and a simple module which I just import and use the similar functions? The only perspective that I think of is that class might instantiate a function several time. For my use I don't have multithread and mostly programs are sequencial. I had a hard time with this at first when I started using Python. I personally come from a background of using Java in an educational environment, so I'm pretty familiar with it. Going from a pure Object-Oriented language, where everything MUST be bundled into a class, and an Object is less of a bit of data and more of a data structure that actually DOES something, was a little difficult. Just repeat this to yourself: Python ISN'T Java. Repeat it until the words start sounding funny to you. Then continue for another 10 minutes. It'll sink in. Anyhow... In Python, classes aren't necessarily treated as things that do stuff (though they can DEFINITELY act in that way!). Python classes are made to hold data. If you have something that you need to save for later, put it in a class and call it a day. If you only have a bunch of functions that are meant to process something, just put them into a module. You'll save yourself some time, you won't have to instantiate a class in order to call the functions, and you'll be happier overall. (I know was happy from being freed from the Pure OO model that Java shoves down your throat!) -- http://mail.python.org/mailman/listinfo/python-list
Re: Looking for Coders or Testers for an Open Source File Organizer
On Jun 14, 8:22 pm, zainul franciscus zainul.francis...@gmail.com wrote: Thank you for the reply. I should have mentioned where I am hosting the code *doh slap on the wrist. I am hosting the code in google code:http://code.google.com/p/mirandafileorganizer/ There is a link to the user/developer guide on how to get started with the software:https://docs.google.com/document/d/1OGvrS5offb27WlkZ5genMJX2El18Aqrnf... Just email me directly if you are interested to join the project and I will add you as a contributor in Google Code Best Wishes Sounds good, I shall take a look at it when I get home from work. (The Google Docs domain is blocked here. Curses!) Just as a tip: on the project's homepage, just write about your project and what it's features are. Don't write in the first person. This isn't about you, it's about the project. O=) -- http://mail.python.org/mailman/listinfo/python-list
How to form a dict out of a string by doing regex ?
data = GEOMETRYCOLLECTION (POINT (-8.96484375 -4.130859375000), POINT (2.021484375000 -2.63671875), POINT (-1.40625000 -11.162109375000), POINT (-11.95312500,-10.89843750), POLYGON ((-21.62109375 1.845703125000,2.46093750 2.197265625000, -18.98437500 -3.69140625, -22.67578125 -3.33984375, -22.14843750 -2.63671875, -21.62109375 1.845703125000)),LINESTRING (-11.95312500 11.337890625000, 7.73437500 11.513671875000, 12.30468750 2.548828125000, 12.216796875000 1.669921875000, 14.501953125000 3.955078125000)) This is my string . How do I traverse through it and form 3 dicts of Point , Polygon and Linestring containing the co-ordinates ? -- http://mail.python.org/mailman/listinfo/python-list
Re: Looking for Coders or Testers for an Open Source File Organizer
Also, can I be added to the project? Email is zcdzi...@gmail.com -- http://mail.python.org/mailman/listinfo/python-list
creating a multi colored graph with respect to the values in y-axis
Hi all, I am a beginner in python. I need to implement a graph with multiple colors in it. In a way, I have a function which varies with respect to time and amplitude. I have time on x-axis and amplitude on y-axis. Lets say the amplitude of the graph is divided into 4 ranges, say 1-3,3-5,5-9, 10-3. I need to plot the graph in such a way that, when the values of amplitude are in a particular range say 1-3, the color of graph should be red. If the amplitude is in the range from 3-5 the graph need to be in color blue etc.., Can somebody guide me on this, how to achive this functionality. Regards, Ravikanth -- http://mail.python.org/mailman/listinfo/python-list
Re: creating a multi colored graph with respect to the values in y-axis
On Jun 15, 11:04 am, Ravikanth vvnrk.vanapa...@gmail.com wrote: Hi all, I am a beginner in python. I need to implement a graph with multiple colors in it. In a way, I have a function which varies with respect to time and amplitude. I have time on x-axis and amplitude on y-axis. Lets say the amplitude of the graph is divided into 4 ranges, say 1-3,3-5,5-9, 10-3. I need to plot the graph in such a way that, when the values of amplitude are in a particular range say 1-3, the color of graph should be red. If the amplitude is in the range from 3-5 the graph need to be in color blue etc.., Can somebody guide me on this, how to achive this functionality. Regards, Ravikanth Check out the examples in matplotlib. http://matplotlib.sourceforge.net/examples/pylab_examples/multicolored_line.html -- http://mail.python.org/mailman/listinfo/python-list
Re: How to form a dict out of a string by doing regex ?
Satyajit Sarangi wrote: data = GEOMETRYCOLLECTION (POINT (-8.96484375 -4.130859375000), POINT (2.021484375000 -2.63671875), POINT (-1.40625000 -11.162109375000), POINT (-11.95312500,-10.89843750), POLYGON ((-21.62109375 1.845703125000,2.46093750 2.197265625000, -18.98437500 -3.69140625, -22.67578125 -3.33984375, -22.14843750 -2.63671875, -21.62109375 1.845703125000)),LINESTRING (-11.95312500 11.337890625000, 7.73437500 11.513671875000, 12.30468750 2.548828125000, 12.216796875000 1.669921875000, 14.501953125000 3.955078125000)) This is my string . How do I traverse through it and form 3 dicts of Point , Polygon and Linestring containing the co-ordinates ? Except for those space-separated number pairs, it could be a job for some well-crafted classes (e.g. `class GEOMETRYCOLLECTION ...`, `class POINT ...`) and eval. My approach would be to use a loop with regexes to recognize the leading element and pick out its arguments, then use the string split and strip methods beyond that point. Like (untested): recognizer = re.compile (r'(?(POINT|POLYGON|LINESTRING)\s*\(+(.*?)\)+,(.*)') # regex is not good with nested brackets, # so kill off outer nested brackets.. s1 = 'GEOMETRYCOLLECTION (' if data.startswith (s1): data = data (len (s1):-1) while data: match = recognizer.match (data) if not match: break # nothing usable in data ## now the matched groups will be: ## 1: the keyword ## 2: the arguments inside the smallest bracketed sequence ## 3: the rest of data ## so use str.split and str.match to pull out the individual arguments, ## and lastly data = match.group (3) This is all from memory. I might have got some details wrong in recognizer. Mel. -- http://mail.python.org/mailman/listinfo/python-list
Re: Looking for Coders or Testers for an Open Source File Organizer
I'm interested in helping out, but I'm also curious to know how this application will differentiate itself from those already in development (i.e. more robust feature set, tighter functionality, better security, or just because it is developed in Py)? Regards Jack On Wed, Jun 15, 2011 at 10:53 AM, Zach Dziura zcdzi...@gmail.com wrote: Also, can I be added to the project? Email is zcdzi...@gmail.com -- http://mail.python.org/mailman/listinfo/python-list -- http://mail.python.org/mailman/listinfo/python-list
Re: creating a multi colored graph with respect to the values in y-axis
On Jun 15, 10:32 am, Wanderer wande...@dialup4less.com wrote: On Jun 15, 11:04 am, Ravikanth vvnrk.vanapa...@gmail.com wrote: Hi all, I am a beginner in python. I need to implement a graph with multiple colors in it. In a way, I have a function which varies with respect to time and amplitude. I have time on x-axis and amplitude on y-axis. Lets say the amplitude of the graph is divided into 4 ranges, say 1-3,3-5,5-9, 10-3. I need to plot the graph in such a way that, when the values of amplitude are in a particular range say 1-3, the color of graph should be red. If the amplitude is in the range from 3-5 the graph need to be in color blue etc.., Can somebody guide me on this, how to achive this functionality. Regards, Ravikanth Check out the examples in matplotlib. http://matplotlib.sourceforge.net/examples/pylab_examples/multicolore...- Hide quoted text - - Show quoted text - I did go through the side wanderer. I wasn't able to figure out the usage of boundaryNorm and lc.set_array(z) , in that link. according to my understanding, cmap = ListedColormap(['r', 'g', 'b']) norm = BoundaryNorm([-1, -0.5, 0.5, 1], cmap.N) In the above lines of code, as per my understanding, Listedcolor map, maps the colors r,g and b to specific indexes into cmap i.e cmap(0) represents red, cmap(1) represents blue cmap(2) represents green. for any index greater than 3 a color of blue is returned.. cmap = ListedColormap(['r', 'g', 'b']) cmap(0) (1.0, 0.0, 0.0, 1.0) cmap(1) (0.0, 0.5, 0.0, 1.0) cmap(2) (0.0, 0.0, 1.0, 1.0) cmap(3) (0.0, 0.0, 1.0, 1.0) In this context, I was not able to understand what does boundaryNorm does. We have 3 colors and we are using 4 values as argument in boundaryNorm. [-1, -0.5, 0.5, 1], the comment reads slope of 'z' is being mapped to the values in boundary norm. How is it handled. Does the function call lc.set_array(z) does it ? what is the exact use of linecollection.set_array(z) in this context. Thanks, Ravikanth -- http://mail.python.org/mailman/listinfo/python-list
Re: How to form a dict out of a string by doing regex ?
One solution is https://gist.github.com/1027445. Note that you have a stray , in your last POINT. I recommend however using some kind of parser framework (PLY?). -- http://mail.python.org/mailman/listinfo/python-list
Re: creating a multi colored graph with respect to the values in y-axis
On Jun 15, 12:00 pm, Ravikanth vvnrk.vanapa...@gmail.com wrote: On Jun 15, 10:32 am, Wanderer wande...@dialup4less.com wrote: On Jun 15, 11:04 am, Ravikanth vvnrk.vanapa...@gmail.com wrote: Hi all, I am a beginner in python. I need to implement a graph with multiple colors in it. In a way, I have a function which varies with respect to time and amplitude. I have time on x-axis and amplitude on y-axis. Lets say the amplitude of the graph is divided into 4 ranges, say 1-3,3-5,5-9, 10-3. I need to plot the graph in such a way that, when the values of amplitude are in a particular range say 1-3, the color of graph should be red. If the amplitude is in the range from 3-5 the graph need to be in color blue etc.., Can somebody guide me on this, how to achive this functionality. Regards, Ravikanth Check out the examples in matplotlib. http://matplotlib.sourceforge.net/examples/pylab_examples/multicolore...Hide quoted text - - Show quoted text - I did go through the side wanderer. I wasn't able to figure out the usage of boundaryNorm and lc.set_array(z) , in that link. according to my understanding, cmap = ListedColormap(['r', 'g', 'b']) norm = BoundaryNorm([-1, -0.5, 0.5, 1], cmap.N) In the above lines of code, as per my understanding, Listedcolor map, maps the colors r,g and b to specific indexes into cmap i.e cmap(0) represents red, cmap(1) represents blue cmap(2) represents green. for any index greater than 3 a color of blue is returned.. cmap = ListedColormap(['r', 'g', 'b']) cmap(0) (1.0, 0.0, 0.0, 1.0) cmap(1) (0.0, 0.5, 0.0, 1.0) cmap(2) (0.0, 0.0, 1.0, 1.0) cmap(3) (0.0, 0.0, 1.0, 1.0) In this context, I was not able to understand what does boundaryNorm does. We have 3 colors and we are using 4 values as argument in boundaryNorm. [-1, -0.5, 0.5, 1], the comment reads slope of 'z' is being mapped to the values in boundary norm. How is it handled. Does the function call lc.set_array(z) does it ? what is the exact use of linecollection.set_array(z) in this context. Thanks, Ravikanth The colors are referring to the slope of the line. Change 'lc.set_array(z)' to 'lc.set_array(y)' and it might be easier to understand. Here are the steps. 1. Define the functions x,y and z, 2. Define the colors 'red', 'green' and 'blue' with ListedColorMap 3. Define the three regions, (-1.0 to -0.50, -0.50 to 0.50, 0.50 to 1.0) with BoundaryNorm([-1,-0.50, 0.50,1], cmap.N). (Why they add the trailing zero in 0.50 and don't change 1 to 1.0; I don't know) 4. Create an array of (x,y) points. 5. Create a collection of tiny segments [(x1,y1),(x2,y2)] and color them with cmap using the boundary rules of norm. lc = LineCollection(segments, cmap=cmap, norm=norm) 6. Use lc.set_array(y) to determine how to color the segments. 7. Plot it. -- http://mail.python.org/mailman/listinfo/python-list
Re: creating a multi colored graph with respect to the values in y-axis
On Jun 15, 11:57 am, Wanderer wande...@dialup4less.com wrote: On Jun 15, 12:00 pm, Ravikanth vvnrk.vanapa...@gmail.com wrote: On Jun 15, 10:32 am, Wanderer wande...@dialup4less.com wrote: On Jun 15, 11:04 am, Ravikanth vvnrk.vanapa...@gmail.com wrote: Hi all, I am a beginner in python. I need to implement a graph with multiple colors in it. In a way, I have a function which varies with respect to time and amplitude. I have time on x-axis and amplitude on y-axis. Lets say the amplitude of the graph is divided into 4 ranges, say 1-3,3-5,5-9, 10-3. I need to plot the graph in such a way that, when the values of amplitude are in a particular range say 1-3, the color of graph should be red. If the amplitude is in the range from 3-5 the graph need to be in color blue etc.., Can somebody guide me on this, how to achive this functionality. Regards, Ravikanth Check out the examples in matplotlib. http://matplotlib.sourceforge.net/examples/pylab_examples/multicolore...quoted text - - Show quoted text - I did go through the side wanderer. I wasn't able to figure out the usage of boundaryNorm and lc.set_array(z) , in that link. according to my understanding, cmap = ListedColormap(['r', 'g', 'b']) norm = BoundaryNorm([-1, -0.5, 0.5, 1], cmap.N) In the above lines of code, as per my understanding, Listedcolor map, maps the colors r,g and b to specific indexes into cmap i.e cmap(0) represents red, cmap(1) represents blue cmap(2) represents green. for any index greater than 3 a color of blue is returned.. cmap = ListedColormap(['r', 'g', 'b']) cmap(0) (1.0, 0.0, 0.0, 1.0) cmap(1) (0.0, 0.5, 0.0, 1.0) cmap(2) (0.0, 0.0, 1.0, 1.0) cmap(3) (0.0, 0.0, 1.0, 1.0) In this context, I was not able to understand what does boundaryNorm does. We have 3 colors and we are using 4 values as argument in boundaryNorm. [-1, -0.5, 0.5, 1], the comment reads slope of 'z' is being mapped to the values in boundary norm. How is it handled. Does the function call lc.set_array(z) does it ? what is the exact use of linecollection.set_array(z) in this context. Thanks, Ravikanth The colors are referring to the slope of the line. Change 'lc.set_array(z)' to 'lc.set_array(y)' and it might be easier to understand. Here are the steps. 1. Define the functions x,y and z, 2. Define the colors 'red', 'green' and 'blue' with ListedColorMap 3. Define the three regions, (-1.0 to -0.50, -0.50 to 0.50, 0.50 to 1.0) with BoundaryNorm([-1,-0.50, 0.50,1], cmap.N). (Why they add the trailing zero in 0.50 and don't change 1 to 1.0; I don't know) 4. Create an array of (x,y) points. 5. Create a collection of tiny segments [(x1,y1),(x2,y2)] and color them with cmap using the boundary rules of norm. lc = LineCollection(segments, cmap=cmap, norm=norm) 6. Use lc.set_array(y) to determine how to color the segments. 7. Plot it.- Hide quoted text - - Show quoted text - Hi Wanderer, Thanks for your help. It works now. Just wanted to know how to go about when I have to do my color mapping not only with respect to range of values on y-axis but also based on some other conditions as well. i.e, say ( range condtion1 condition2 ) where condition1 could be occurance of some event say, a flag1 is set true and condition2 may be another flag2 set to false. Just wanted to use my color mapping not only based on boundaries but also on occurance of other events as well. In this context do i have to modify the source of BoundaryNorm in matplotlib function...?? Can you give me some insights into this. Regards, Ravikanth -- http://mail.python.org/mailman/listinfo/python-list
Re: creating a multi colored graph with respect to the values in y-axis
On Jun 15, 1:28 pm, Ravikanth vvnrk.vanapa...@gmail.com wrote: On Jun 15, 11:57 am, Wanderer wande...@dialup4less.com wrote: On Jun 15, 12:00 pm, Ravikanth vvnrk.vanapa...@gmail.com wrote: On Jun 15, 10:32 am, Wanderer wande...@dialup4less.com wrote: On Jun 15, 11:04 am, Ravikanth vvnrk.vanapa...@gmail.com wrote: Hi all, I am a beginner in python. I need to implement a graph with multiple colors in it. In a way, I have a function which varies with respect to time and amplitude. I have time on x-axis and amplitude on y-axis. Lets say the amplitude of the graph is divided into 4 ranges, say 1-3,3-5,5-9, 10-3. I need to plot the graph in such a way that, when the values of amplitude are in a particular range say 1-3, the color of graph should be red. If the amplitude is in the range from 3-5 the graph need to be in color blue etc.., Can somebody guide me on this, how to achive this functionality. Regards, Ravikanth Check out the examples in matplotlib. http://matplotlib.sourceforge.net/examples/pylab_examples/multicolore...text - - Show quoted text - I did go through the side wanderer. I wasn't able to figure out the usage of boundaryNorm and lc.set_array(z) , in that link. according to my understanding, cmap = ListedColormap(['r', 'g', 'b']) norm = BoundaryNorm([-1, -0.5, 0.5, 1], cmap.N) In the above lines of code, as per my understanding, Listedcolor map, maps the colors r,g and b to specific indexes into cmap i.e cmap(0) represents red, cmap(1) represents blue cmap(2) represents green. for any index greater than 3 a color of blue is returned.. cmap = ListedColormap(['r', 'g', 'b']) cmap(0) (1.0, 0.0, 0.0, 1.0) cmap(1) (0.0, 0.5, 0.0, 1.0) cmap(2) (0.0, 0.0, 1.0, 1.0) cmap(3) (0.0, 0.0, 1.0, 1.0) In this context, I was not able to understand what does boundaryNorm does. We have 3 colors and we are using 4 values as argument in boundaryNorm. [-1, -0.5, 0.5, 1], the comment reads slope of 'z' is being mapped to the values in boundary norm. How is it handled. Does the function call lc.set_array(z) does it ? what is the exact use of linecollection.set_array(z) in this context. Thanks, Ravikanth The colors are referring to the slope of the line. Change 'lc.set_array(z)' to 'lc.set_array(y)' and it might be easier to understand. Here are the steps. 1. Define the functions x,y and z, 2. Define the colors 'red', 'green' and 'blue' with ListedColorMap 3. Define the three regions, (-1.0 to -0.50, -0.50 to 0.50, 0.50 to 1.0) with BoundaryNorm([-1,-0.50, 0.50,1], cmap.N). (Why they add the trailing zero in 0.50 and don't change 1 to 1.0; I don't know) 4. Create an array of (x,y) points. 5. Create a collection of tiny segments [(x1,y1),(x2,y2)] and color them with cmap using the boundary rules of norm. lc = LineCollection(segments, cmap=cmap, norm=norm) 6. Use lc.set_array(y) to determine how to color the segments. 7. Plot it.- Hide quoted text - - Show quoted text - Hi Wanderer, Thanks for your help. It works now. Just wanted to know how to go about when I have to do my color mapping not only with respect to range of values on y-axis but also based on some other conditions as well. i.e, say ( range condtion1 condition2 ) where condition1 could be occurance of some event say, a flag1 is set true and condition2 may be another flag2 set to false. Just wanted to use my color mapping not only based on boundaries but also on occurance of other events as well. In this context do i have to modify the source of BoundaryNorm in matplotlib function...?? Can you give me some insights into this. Regards, Ravikanth I don't know if there is another way, but I think changing the lc.set_array input would be the easiest. Each point has an (x,y,z) where z determines the color by what range it is in. You would use your conditions to set points in z to the desired color. -- http://mail.python.org/mailman/listinfo/python-list
Re: creating a multi colored graph with respect to the values in y-axis
On Jun 15, 12:59 pm, Wanderer wande...@dialup4less.com wrote: On Jun 15, 1:28 pm, Ravikanth vvnrk.vanapa...@gmail.com wrote: On Jun 15, 11:57 am, Wanderer wande...@dialup4less.com wrote: On Jun 15, 12:00 pm, Ravikanth vvnrk.vanapa...@gmail.com wrote: On Jun 15, 10:32 am, Wanderer wande...@dialup4less.com wrote: On Jun 15, 11:04 am, Ravikanth vvnrk.vanapa...@gmail.com wrote: Hi all, I am a beginner in python. I need to implement a graph with multiple colors in it. In a way, I have a function which varies with respect to time and amplitude. I have time on x-axis and amplitude on y-axis. Lets say the amplitude of the graph is divided into 4 ranges, say 1-3,3-5,5-9, 10-3. I need to plot the graph in such a way that, when the values of amplitude are in a particular range say 1-3, the color of graph should be red. If the amplitude is in the range from 3-5 the graph need to be in color blue etc.., Can somebody guide me on this, how to achive this functionality. Regards, Ravikanth Check out the examples in matplotlib. http://matplotlib.sourceforge.net/examples/pylab_examples/multicolore...- - Show quoted text - I did go through the side wanderer. I wasn't able to figure out the usage of boundaryNorm and lc.set_array(z) , in that link. according to my understanding, cmap = ListedColormap(['r', 'g', 'b']) norm = BoundaryNorm([-1, -0.5, 0.5, 1], cmap.N) In the above lines of code, as per my understanding, Listedcolor map, maps the colors r,g and b to specific indexes into cmap i.e cmap(0) represents red, cmap(1) represents blue cmap(2) represents green. for any index greater than 3 a color of blue is returned.. cmap = ListedColormap(['r', 'g', 'b']) cmap(0) (1.0, 0.0, 0.0, 1.0) cmap(1) (0.0, 0.5, 0.0, 1.0) cmap(2) (0.0, 0.0, 1.0, 1.0) cmap(3) (0.0, 0.0, 1.0, 1.0) In this context, I was not able to understand what does boundaryNorm does. We have 3 colors and we are using 4 values as argument in boundaryNorm. [-1, -0.5, 0.5, 1], the comment reads slope of 'z' is being mapped to the values in boundary norm. How is it handled. Does the function call lc.set_array(z) does it ? what is the exact use of linecollection.set_array(z) in this context. Thanks, Ravikanth The colors are referring to the slope of the line. Change 'lc.set_array(z)' to 'lc.set_array(y)' and it might be easier to understand. Here are the steps. 1. Define the functions x,y and z, 2. Define the colors 'red', 'green' and 'blue' with ListedColorMap 3. Define the three regions, (-1.0 to -0.50, -0.50 to 0.50, 0.50 to 1.0) with BoundaryNorm([-1,-0.50, 0.50,1], cmap.N). (Why they add the trailing zero in 0.50 and don't change 1 to 1.0; I don't know) 4. Create an array of (x,y) points. 5. Create a collection of tiny segments [(x1,y1),(x2,y2)] and color them with cmap using the boundary rules of norm. lc = LineCollection(segments, cmap=cmap, norm=norm) 6. Use lc.set_array(y) to determine how to color the segments. 7. Plot it.- Hide quoted text - - Show quoted text - Hi Wanderer, Thanks for your help. It works now. Just wanted to know how to go about when I have to do my color mapping not only with respect to range of values on y-axis but also based on some other conditions as well. i.e, say ( range condtion1 condition2 ) where condition1 could be occurance of some event say, a flag1 is set true and condition2 may be another flag2 set to false. Just wanted to use my color mapping not only based on boundaries but also on occurance of other events as well. In this context do i have to modify the source of BoundaryNorm in matplotlib function...?? Can you give me some insights into this. Regards, Ravikanth I don't know if there is another way, but I think changing the lc.set_array input would be the easiest. Each point has an (x,y,z) where z determines the color by what range it is in. You would use your conditions to set points in z to the desired color.- Hide quoted text - - Show quoted text - does (x,y,z) mean adding another dimension 'z' (which is to be used as a condition) to the step 4) as suggested in the steps outlined to me before ? -- http://mail.python.org/mailman/listinfo/python-list
Re: How to form a dict out of a string by doing regex ?
On 6/15/2011 10:42 AM, Satyajit Sarangi wrote: data = GEOMETRYCOLLECTION (POINT (-8.96484375 -4.130859375000), POINT (2.021484375000 -2.63671875), POINT (-1.40625000 -11.162109375000), POINT (-11.95312500,-10.89843750), POLYGON ((-21.62109375 1.845703125000,2.46093750 2.197265625000, -18.98437500 -3.69140625, -22.67578125 -3.33984375, -22.14843750 -2.63671875, -21.62109375 1.845703125000)),LINESTRING (-11.95312500 11.337890625000, 7.73437500 11.513671875000, 12.30468750 2.548828125000, 12.216796875000 1.669921875000, 14.501953125000 3.955078125000)) This is my string . If this what you are given by an unchangable external source or can you get something a bit better? One object per line would make the problem pretty simple, with no regex required. How do I traverse through it and form 3 dicts of Point , Polygon and Linestring containing the co-ordinates ? Dicts map keys to values. I do not see any key values above. It looks like you really want three sets. -- Terry Jan Reedy -- http://mail.python.org/mailman/listinfo/python-list
Re: creating a multi colored graph with respect to the values in y-axis
On Jun 15, 2:10 pm, Ravikanth vvnrk.vanapa...@gmail.com wrote: On Jun 15, 12:59 pm, Wanderer wande...@dialup4less.com wrote: On Jun 15, 1:28 pm, Ravikanth vvnrk.vanapa...@gmail.com wrote: On Jun 15, 11:57 am, Wanderer wande...@dialup4less.com wrote: On Jun 15, 12:00 pm, Ravikanth vvnrk.vanapa...@gmail.com wrote: On Jun 15, 10:32 am, Wanderer wande...@dialup4less.com wrote: On Jun 15, 11:04 am, Ravikanth vvnrk.vanapa...@gmail.com wrote: Hi all, I am a beginner in python. I need to implement a graph with multiple colors in it. In a way, I have a function which varies with respect to time and amplitude. I have time on x-axis and amplitude on y-axis. Lets say the amplitude of the graph is divided into 4 ranges, say 1-3,3-5,5-9, 10-3. I need to plot the graph in such a way that, when the values of amplitude are in a particular range say 1-3, the color of graph should be red. If the amplitude is in the range from 3-5 the graph need to be in color blue etc.., Can somebody guide me on this, how to achive this functionality. Regards, Ravikanth Check out the examples in matplotlib. http://matplotlib.sourceforge.net/examples/pylab_examples/multicolore... - Show quoted text - I did go through the side wanderer. I wasn't able to figure out the usage of boundaryNorm and lc.set_array(z) , in that link. according to my understanding, cmap = ListedColormap(['r', 'g', 'b']) norm = BoundaryNorm([-1, -0.5, 0.5, 1], cmap.N) In the above lines of code, as per my understanding, Listedcolor map, maps the colors r,g and b to specific indexes into cmap i.e cmap(0) represents red, cmap(1) represents blue cmap(2) represents green. for any index greater than 3 a color of blue is returned.. cmap = ListedColormap(['r', 'g', 'b']) cmap(0) (1.0, 0.0, 0.0, 1.0) cmap(1) (0.0, 0.5, 0.0, 1.0) cmap(2) (0.0, 0.0, 1.0, 1.0) cmap(3) (0.0, 0.0, 1.0, 1.0) In this context, I was not able to understand what does boundaryNorm does. We have 3 colors and we are using 4 values as argument in boundaryNorm. [-1, -0.5, 0.5, 1], the comment reads slope of 'z' is being mapped to the values in boundary norm. How is it handled. Does the function call lc.set_array(z) does it ? what is the exact use of linecollection.set_array(z) in this context. Thanks, Ravikanth The colors are referring to the slope of the line. Change 'lc.set_array(z)' to 'lc.set_array(y)' and it might be easier to understand. Here are the steps. 1. Define the functions x,y and z, 2. Define the colors 'red', 'green' and 'blue' with ListedColorMap 3. Define the three regions, (-1.0 to -0.50, -0.50 to 0.50, 0.50 to 1.0) with BoundaryNorm([-1,-0.50, 0.50,1], cmap.N). (Why they add the trailing zero in 0.50 and don't change 1 to 1.0; I don't know) 4. Create an array of (x,y) points. 5. Create a collection of tiny segments [(x1,y1),(x2,y2)] and color them with cmap using the boundary rules of norm. lc = LineCollection(segments, cmap=cmap, norm=norm) 6. Use lc.set_array(y) to determine how to color the segments. 7. Plot it.- Hide quoted text - - Show quoted text - Hi Wanderer, Thanks for your help. It works now. Just wanted to know how to go about when I have to do my color mapping not only with respect to range of values on y-axis but also based on some other conditions as well. i.e, say ( range condtion1 condition2 ) where condition1 could be occurance of some event say, a flag1 is set true and condition2 may be another flag2 set to false. Just wanted to use my color mapping not only based on boundaries but also on occurance of other events as well. In this context do i have to modify the source of BoundaryNorm in matplotlib function...?? Can you give me some insights into this. Regards, Ravikanth I don't know if there is another way, but I think changing the lc.set_array input would be the easiest. Each point has an (x,y,z) where z determines the color by what range it is in. You would use your conditions to set points in z to the desired color.- Hide quoted text - - Show quoted text - does (x,y,z) mean adding another dimension 'z' (which is to be used as a condition) to the step 4) as suggested in the steps outlined to me before ? In the matplotlib example they x,y and z. x = np.linspace(0, 3 * np.pi, 500) y = np.sin(x) z = np.cos(0.5 * (x[:-1] + x[1:])) # first derivative Where x and y are the coordinates of the plot and z is the constraint used to color the line. You can modify z with you conditions by adding code that looks like for i, xvalue in enumerate(x); if mycondition(xvalue): z[i] = 0
Re: creating a multi colored graph with respect to the values in y-axis
On Jun 15, 1:59 pm, Wanderer wande...@dialup4less.com wrote: On Jun 15, 2:10 pm, Ravikanth vvnrk.vanapa...@gmail.com wrote: On Jun 15, 12:59 pm, Wanderer wande...@dialup4less.com wrote: On Jun 15, 1:28 pm, Ravikanth vvnrk.vanapa...@gmail.com wrote: On Jun 15, 11:57 am, Wanderer wande...@dialup4less.com wrote: On Jun 15, 12:00 pm, Ravikanth vvnrk.vanapa...@gmail.com wrote: On Jun 15, 10:32 am, Wanderer wande...@dialup4less.com wrote: On Jun 15, 11:04 am, Ravikanth vvnrk.vanapa...@gmail.com wrote: Hi all, I am a beginner in python. I need to implement a graph with multiple colors in it. In a way, I have a function which varies with respect to time and amplitude. I have time on x-axis and amplitude on y-axis. Lets say the amplitude of the graph is divided into 4 ranges, say 1-3,3-5,5-9, 10-3. I need to plot the graph in such a way that, when the values of amplitude are in a particular range say 1-3, the color of graph should be red. If the amplitude is in the range from 3-5 the graph need to be in color blue etc.., Can somebody guide me on this, how to achive this functionality. Regards, Ravikanth Check out the examples in matplotlib. http://matplotlib.sourceforge.net/examples/pylab_examples/multicolore... - Show quoted text - I did go through the side wanderer. I wasn't able to figure out the usage of boundaryNorm and lc.set_array(z) , in that link. according to my understanding, cmap = ListedColormap(['r', 'g', 'b']) norm = BoundaryNorm([-1, -0.5, 0.5, 1], cmap.N) In the above lines of code, as per my understanding, Listedcolor map, maps the colors r,g and b to specific indexes into cmap i.e cmap(0) represents red, cmap(1) represents blue cmap(2) represents green. for any index greater than 3 a color of blue is returned.. cmap = ListedColormap(['r', 'g', 'b']) cmap(0) (1.0, 0.0, 0.0, 1.0) cmap(1) (0.0, 0.5, 0.0, 1.0) cmap(2) (0.0, 0.0, 1.0, 1.0) cmap(3) (0.0, 0.0, 1.0, 1.0) In this context, I was not able to understand what does boundaryNorm does. We have 3 colors and we are using 4 values as argument in boundaryNorm. [-1, -0.5, 0.5, 1], the comment reads slope of 'z' is being mapped to the values in boundary norm. How is it handled. Does the function call lc.set_array(z) does it ? what is the exact use of linecollection.set_array(z) in this context. Thanks, Ravikanth The colors are referring to the slope of the line. Change 'lc.set_array(z)' to 'lc.set_array(y)' and it might be easier to understand. Here are the steps. 1. Define the functions x,y and z, 2. Define the colors 'red', 'green' and 'blue' with ListedColorMap 3. Define the three regions, (-1.0 to -0.50, -0.50 to 0.50, 0.50 to 1.0) with BoundaryNorm([-1,-0.50, 0.50,1], cmap.N). (Why they add the trailing zero in 0.50 and don't change 1 to 1.0; I don't know) 4. Create an array of (x,y) points. 5. Create a collection of tiny segments [(x1,y1),(x2,y2)] and color them with cmap using the boundary rules of norm. lc = LineCollection(segments, cmap=cmap, norm=norm) 6. Use lc.set_array(y) to determine how to color the segments. 7. Plot it.- Hide quoted text - - Show quoted text - Hi Wanderer, Thanks for your help. It works now. Just wanted to know how to go about when I have to do my color mapping not only with respect to range of values on y-axis but also based on some other conditions as well. i.e, say ( range condtion1 condition2 ) where condition1 could be occurance of some event say, a flag1 is set true and condition2 may be another flag2 set to false. Just wanted to use my color mapping not only based on boundaries but also on occurance of other events as well. In this context do i have to modify the source of BoundaryNorm in matplotlib function...?? Can you give me some insights into this. Regards, Ravikanth I don't know if there is another way, but I think changing the lc.set_array input would be the easiest. Each point has an (x,y,z) where z determines the color by what range it is in. You would use your conditions to set points in z to the desired color.- Hide quoted text - - Show quoted text - does (x,y,z) mean adding another dimension 'z' (which is to be used as a condition) to the step 4) as suggested in the steps outlined to me before ? In the matplotlib example they x,y and z. x = np.linspace(0, 3 * np.pi, 500) y = np.sin(x) z = np.cos(0.5 * (x[:-1] + x[1:])) # first derivative Where x and y are the coordinates of the plot and z is
Re: Keyboard Layout: Dvorak vs Colemak: is it Worthwhile to Improve the Dvorak Layout?
On Tue, Jun 14, 2011 at 12:11 AM, Xah Lee xah...@gmail.com wrote: numerical keypad is useful to many. Most people can't touch type. Even for touch typist, many doesn't do the number keys. So, when they need to type credit, phone number, etc, they go for the number pad. It's not about being *able* to touch type with the number keys in the main section. When you're doing primarily numerical data entry, the number pad is typically much faster to touch type with than the main number keys. In the main section, the number keys are too far removed from the home row to be able to type with any speed, and if you reposition your hands directly above them then the Enter, decimal, and Shift keys are no longer easily accessible. Touch typing on the number pad gives you everything you're likely to need in easy reach of your right hand, and if you need something else as well then your left hand is free to hover over it. -- http://mail.python.org/mailman/listinfo/python-list
Re: Looking for Coders or Testers for an Open Source File Organizer
On Jun 16, 2:53 am, Zach Dziura zcdzi...@gmail.com wrote: Also, can I be added to the project? Email is zcdzi...@gmail.com Thank you for the interest, I have added you as one of the committer. Let me know if you have any problem with the application, just IM me at gtalk, or email me. I am located in Wellington, New Zealand, so there might be some lag in our communication. I shall try to answer any of your questions as prompt as possible =) -- http://mail.python.org/mailman/listinfo/python-list
Re: Looking for Coders or Testers for an Open Source File Organizer
On Jun 16, 2:49 am, Zach Dziura zcdzi...@gmail.com wrote: On Jun 14, 8:22 pm, zainul franciscus zainul.francis...@gmail.com wrote: Thank you for the reply. I should have mentioned where I am hosting the code *doh slap on the wrist. I am hosting the code in google code:http://code.google.com/p/mirandafileorganizer/ There is a link to the user/developer guide on how to get started with the software:https://docs.google.com/document/d/1OGvrS5offb27WlkZ5genMJX2El18Aqrnf... Just email me directly if you are interested to join the project and I will add you as a contributor in Google Code Best Wishes Sounds good, I shall take a look at it when I get home from work. (The Google Docs domain is blocked here. Curses!) Just as a tip: on the project's homepage, just write about your project and what it's features are. Don't write in the first person. This isn't about you, it's about the project. O=) Thank you for the feedback, I really appreciate it =) -- http://mail.python.org/mailman/listinfo/python-list
Re: Python for Web
On Wed, Jun 15, 2011 at 5:11 AM, bruno.desthuilli...@gmail.com bruno.desthuilli...@gmail.com wrote: On Jun 15, 9:50 am, sidRo slacky2...@gmail.com wrote: Is Python only for server side? Is it a theoretical question or a practical one ?-) More seriously: except for the old proof-of-concept Grail browser, no known browser uses Python as a client-side scripting language. Not quite the same thing, but there's pyjamas. Geremy Condra -- http://mail.python.org/mailman/listinfo/python-list
os.path and Path
In my continuing quest for Python Mastery (and because I felt like it ;) I decided to code a Path object so I could dispense with all the os.path.join and os.path.split and os.path.splitext, etc., etc., and so forth. While so endeavoring a couple threads came back and had a friendly little chat in my head: Thread 1: objects of different types compare unequal self: nonsense! we have the power to say what happens in __eq__! Thread 2: objects that __hash__ the same *must* compare __eq__! self: um, what? ... wait, only immutable objects hash... Thread 2: you're Path object is immutable... self: argh! Here's the rub: I'm on Windows (yes, pity me...) but I prefer the unices, so I'd like to have / seperate my paths. But I'm on Windows... So I thought, Hey! I'll just do some conversions in __eq__ and life will be great! -- some_path = Path('/source/python/some_project') -- some_path == '/source/python/some_project' True -- some_path == r'\source\python\some_project' True -- # if on a Mac -- some_path == ':source:python:some_project' True -- # oh, and because I'm on Windows with case-insensitive file names... -- some_path == '/source/Python/some_PROJECT' True And then, of course, the ghosts of threads past came and visited. For those that don't know, the __hash__ must be the same if __eq__ is the same because __hash__ is primarily a shortcut for __eq__ -- this is important when you have containers that are relying on this behavior, such as set() and dict(). So, I suppose I shall have to let go of my dreams of -- Path('/some/path/and/file') == '\\some\\path\\and\\file' and settle for -- Path('...') == Path('...') but I don't have to like it. :( /whine ~Ethan~ What, you didn't see the opening 'whine' tag? Oh, well, my xml isn't very good... ;) -- http://mail.python.org/mailman/listinfo/python-list
Trapping MySQLdb warnings
Using Python 2.6.5 on linux. When using MySQLdb I am getting warnings printed to stdout, but I would like to trap, display and log those warnings. In the past I have used _mysql_exceptions.Warning, but that approach is not working in this case. My cursor is created with the relevant following code: ## connection object self.__conn = MySQLdb.connect(db = self.__db, host = self.__host, user = self.__user, passwd = self.__passwd) ## cursor object self.__rdb = self.__conn.cursor() ## And implemented as : try : self.__rdb.execute(S) except _mysql_exceptions.Warning,e: raise e ## replace with log(e) What else needs to be done? TIA -- Tim tim at johnsons-web dot com or akwebsoft dot com http://www.akwebsoft.com -- http://mail.python.org/mailman/listinfo/python-list
Re: Trapping MySQLdb warnings
On Wed, Jun 15, 2011 at 6:58 PM, Tim Johnson t...@johnsons-web.com wrote: Using Python 2.6.5 on linux. When using MySQLdb I am getting warnings printed to stdout, but I would like to trap, display and log those warnings. In the past I have used _mysql_exceptions.Warning, but that approach is not working in this case. My cursor is created with the relevant following code: ## connection object self.__conn = MySQLdb.connect(db = self.__db, host = self.__host, user = self.__user, passwd = self.__passwd) ## cursor object self.__rdb = self.__conn.cursor() ## And implemented as : try : self.__rdb.execute(S) except _mysql_exceptions.Warning,e: raise e ## replace with log(e) What else needs to be done? Have you tried http://docs.python.org/library/warnings.html#temporarily-suppressing-warnings ? Geremy Condra -- http://mail.python.org/mailman/listinfo/python-list
pycurl and MAX_RECV_SPEED_LARGE
Hello Folks, I have a problem with pycurl. I need to do a download with a lower rate, + or - 1 Kb / 128bytes. I use the MAX_RECV_SPEED_LARGE setting with 128 as value. My problem is: The download take a long time to be finished. File: test.jpg 92 KB, with 128 rate, take 2.38 Minutes. The strange behavior is that: The connection keep ESTABLISHED only 1/5 from all time ( 2.38 minutes ) Analyzing with wireshark, I see that: After pass 1/5 of all time, do not change packages anymore until reach 2.38 minutes, and client send a RST ACK. Have a high delay between the transfer and the finished connection. I need to solution that I can download with a lower rate, include using Multi-Threading with many simultaneous downloads. Follow my test code: import pycurl import random import os def download1(t_url): headers = [ 'Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8', 'Accept-Language: en-us,pt-br;q=0.8,pt;q=0.5,en;q=0.3', 'Accept-Encoding: gzip,deflate', 'Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7', 'Cache-control: no-cache', 'Pragma: no-cache', 'Connection: Keep-Alive', 'Keep-Alive: 300'] c = pycurl.Curl() f = /tmp/teste.tmp c.setopt(c.URL, t_url) c.setopt(c.FAILONERROR, 1) # c.setopt(c.VERBOSE, 1) c.setopt(c.MAX_RECV_SPEED_LARGE, 128) #c.setopt(c.TIMEOUT, timeout) c.setopt(c.NOSIGNAL, 1) c.setopt(pycurl.HTTPHEADER, headers) c.setopt(c.CONNECTTIMEOUT,10) c.setopt(c.WRITEDATA, file(f,w)) c.setopt(c.USERAGENT,XADASSDASDASD) try: c.perform() except pycurl.error: print Connection Problem c.close() return 2 else: print Download Complete print f c.close() return 0 download1(http://192.168.111.128/teste.jpg;) Thank You. Emanuel -- http://mail.python.org/mailman/listinfo/python-list
Re: Trapping MySQLdb warnings
* geremy condra debat...@gmail.com [110615 18:03]: On Wed, Jun 15, 2011 at 6:58 PM, Tim Johnson t...@johnsons-web.com wrote: Using Python 2.6.5 on linux. When using MySQLdb I am getting warnings printed to stdout, but I would like to trap, display and log those warnings. . Have you tried http://docs.python.org/library/warnings.html#temporarily-suppressing-warnings Hi Geremy: I just looked at the docs there. This is a new module (to me), and I am unsure of the implementation or whether this is what I should use. I tried the following : try : self.__rdb.execute(S) except warnings.catch_warnings: std.mrk('',0,mysql.py:196) ## DEBUG call ## and it does not look like my code modification ## is catching the warning. Thanks for introducing me to this new module, but I'm not sure if it is what I should be using. BTW: End of day in this part of the world. I look forward to any other comments on this subject tomorrow. chees -- Tim tim at johnsons-web dot com or akwebsoft dot com http://www.akwebsoft.com -- http://mail.python.org/mailman/listinfo/python-list
[issue12319] [http.client] HTTPConnection.putrequest not support chunked Transfer-Encodings to send data
harobed steph...@harobed.org added the comment: Now I'm confused. Per the HTTP specification, GET requests don't have a body, so Transfer-Encoding: chunked doesn't apply to them. Are you sure you don't confuse with the response that the server sends? In responses, Transfer-Encoding: chunked is very common. Sorry, yes GET requests have Transfer-Encoding: chunked in server response. PUT requests can send body data in transfer-encoding chunked mode. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue12319 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue12327] in HTTPConnection the are len(body) and TypeError catch exception to detect if body is file like object, this hack do work with StringIO object
harobed steph...@harobed.org added the comment: But if the len information is available, why not return it? I use HTTPConnection to simulate Apple Finder WebDAV client. When this WebDAV client do PUT request, it transmit data in chunked encoding mode and not set Content-Length HTTP field. Do you understand my context ? Regards, Stephane -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue12327 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue11147] _Py_ANNOTATE_MEMORY_ORDER has unused argument, effects code which includes Python.h
Changes by Jelte pyt...@tjeb.nl: -- nosy: +Tjebbe ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue11147 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue11934] build with --prefix=/dev/null and zlib enabled in Modules/Setup failed
Petri Lehtinen pe...@digip.org added the comment: FWIW, I recall that I built 2.7 a while back with --prefix=/home/user/something and it also failed to find zlib. Due to lack of time, I didn't debug it very deeply then, though. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue11934 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue12337] Need real TextIOWrapper for stdin/stdout
Antoine Pitrou pit...@free.fr added the comment: I can't reproduce. Victor? Z:\defaultPCbuild\amd64\python_d.exe Python 3.3a0 (default, Jun 8 2011, 17:49:13) [MSC v.1500 64 bit (AMD64)] on win32 Type help, copyright, credits or license for more information. import sys sys.stdin.readline() a 'a\n' ^Z Z:\defaultPCbuild\amd64\python_d.exe -u Python 3.3a0 (default, Jun 8 2011, 17:49:13) [MSC v.1500 64 bit (AMD64)] on win32 Type help, copyright, credits or license for more information. import sys sys.stdin.readline() a 'a\n' -- nosy: +amaury.forgeotdarc, haypo, pitrou versions: +Python 3.3 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue12337 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue12337] Need real TextIOWrapper for stdin/stdout
STINNER Victor victor.stin...@haypocalc.com added the comment: I think that this issue is a duplicate of the issue #11272: Python 3.2.1 has been released recently and contains the fix. Can you try this version Fan? -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue12337 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue12337] Need real TextIOWrapper for stdin/stdout
STINNER Victor victor.stin...@haypocalc.com added the comment: Note: Python 3.2 has another regression related to the Windows console (issue #11395), bug fixed in 3.2.1. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue12337 ___ ___ 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
sbt shibt...@gmail.com added the comment: pipe_interruptible.patch is a patch to support to making poll() interruptible. It applies on top of pipe_poll_2.patch. I am not sure what the guarantees are for when KeyboardInterrupt will be raised. I would have done it a bit differently if I knew a good way to test whether the current thread is the main one. Maybe there should be something like PyThread_is_main() and/or threading.ismain(). -- Added file: http://bugs.python.org/file22367/pipe_interruptible.patch ___ 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
[issue12338] multiprocessing.util._eintr_retry doen't recalculate timeouts
New submission from sbt shibt...@gmail.com: multiprocessing.util._eintr_retry is only used to wrap select.select, but it fails to recalculate timeouts. Also, it will never retry the function it wraps because of a missing import errno. I think it would be better to just implement the retrying version of select directly. -- messages: 138364 nosy: sbt priority: normal severity: normal status: open title: multiprocessing.util._eintr_retry doen't recalculate timeouts ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue12338 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue12313] make install misses packaging module
Éric Araujo mer...@netwok.org added the comment: Nice to see my search didn't find this bug. ;) Do you remember what search terms you tried? I already committed a change to install packaging, but you may want to revert that and commit the patch in this issue. I honestly don’t know. Do we have a policy about using intermediary variables (like XMLLIBSUBDIRS) or not? Can we assume find(1) exists on the system and use it? -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue12313 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue11113] html.entities mapping dicts need updating?
Éric Araujo mer...@netwok.org added the comment: Ah, this changes the situation. I suppose it’s too late to stop pretending that HTML and XHTML are nearly the same thing (IOW change the doc), so apos needs to be defined for XHTML. IMO, we need a way to have the right entity references for HTML 4.01, XHTML 1.0 and HTML5, not put them all in one mapping. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue3 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue7969] shutil.copytree error handling non-standard and partially broken
Éric Araujo mer...@netwok.org added the comment: See also http://mail.python.org/pipermail/docs/2010-August/001207.html for a similar report. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue7969 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue12327] in HTTPConnection the are len(body) and TypeError catch exception to detect if body is file like object, this hack do work with StringIO object
R. David Murray rdmur...@bitdance.com added the comment: The code you are suggesting patching is trying its best to return a length. If that code needs to be fixed to not throw an error when confronted with a StringIO, then it should do its best to return a length. Your original message on the ticket did not mention chunked encoding, and indeed that appears to be correct. This bug doesn't appear, from what you have written and what I see in the 3.x code, to have anything to do with chunked encoding. -- stage: - needs patch type: - behavior ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue12327 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue12339] logging.Formatter.format() assumes exception to support str() method which is not true for many libraries.
New submission from Piotr Czachur zim...@gmail.com: If I want my application to be bullet-proof against external libraries that can (and often do) raise Exception(u'nonascii'), I cannot use python's logger.exception() directly, as it will end up with UnicodeDecodeError. The reason is hidden in Formatter.format() which does: s = self._fmt % record.__dict__ One can use his own formatter that can handle UnicodeDecodeError, but many users are quite unaware of such issue and it would be great if Python can handle it by itself. Here is a simple case. e = Exception(u'ą') logging.basicConfig() logging.getLogger('general').exception(u'ą') ą None logging.getLogger('general').exception(e) Traceback (most recent call last): File /usr/lib/python2.7/logging/__init__.py, line 842, in emit msg = self.format(record) File /usr/lib/python2.7/logging/__init__.py, line 719, in format return fmt.format(record) File /usr/lib/python2.7/logging/__init__.py, line 467, in format s = self._fmt % record.__dict__ UnicodeEncodeError: 'ascii' codec can't encode character u'\u0105' in position 0: ordinal not in range(128) Logged from file stdin, line 1 unicode(e) u'\u0105' str(e) Traceback (most recent call last): File stdin, line 1, in module UnicodeEncodeError: 'ascii' codec can't encode character u'\u0105' in position 0: ordinal not in range(128) -- components: Library (Lib) messages: 138369 nosy: Piotr.Czachur priority: normal severity: normal status: open title: logging.Formatter.format() assumes exception to support str() method which is not true for many libraries. type: feature request versions: Python 2.7 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue12339 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue12339] logging.Formatter.format() assumes exception to support str() method which is not true for many libraries.
Changes by Éric Araujo mer...@netwok.org: -- nosy: +eric.araujo, vinay.sajip ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue12339 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue11934] build with --prefix=/dev/null and zlib enabled in Modules/Setup failed
R. David Murray rdmur...@bitdance.com added the comment: I normally build using --prefix, often with --prefix=/dev/null, and I can't recall any version not building zlib. Of course, I don't uncomment the zlib entry in Modules/Setup. As far as I can see the zlib entry is unique in Setup in using prefix, so it probably is a bug (or, rather, a holdover from when there were various issues with the platform zlib). -- versions: -Python 2.6, Python 3.1 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue11934 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue9741] msgfmt.py generates invalid mo because msgfmt.make() does not clear dictionary
Changes by Timothy Lee timothy.ty@gmail.com: Added file: http://bugs.python.org/file22368/test_msgfmt.py ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue9741 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue9741] msgfmt.py generates invalid mo because msgfmt.make() does not clear dictionary
Changes by Timothy Lee timothy.ty@gmail.com: Added file: http://bugs.python.org/file22369/test1.po ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue9741 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue9741] msgfmt.py generates invalid mo because msgfmt.make() does not clear dictionary
Changes by Timothy Lee timothy.ty@gmail.com: Added file: http://bugs.python.org/file22370/test2.po ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue9741 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue12339] logging.Formatter.format() assumes exception to support str() method which is not true for many libraries.
Vinay Sajip vinay_sa...@yahoo.co.uk added the comment: This is happening because if you pass an object instead of a string as the first argument in a logging call, it's treated as a message object whose __str__() will be called to get the actual message when it's needed, as documented here: http://docs.python.org/howto/logging.html#arbitrary-object-messages If, instead, you do it like this: # coding: utf-8 import logging logging.basicConfig() try: raise Exception(u'ą') except Exception: logging.getLogger('general').exception(u'An error occurred') you get ERROR:general:An error occurred Traceback (most recent call last): File bug_12339.py, line 6, in module raise Exception(u'ą') Exception: \u0105 -- resolution: - invalid status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue12339 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue9741] msgfmt.py generates invalid mo because msgfmt.make() does not clear dictionary
Éric Araujo mer...@netwok.org added the comment: Thanks! In my latest message, I had forgotten that msgfmt was in Tools, not in the standard library, and as such has no automated regression tests. Features get added and bugs get fixed after manual testing only, so I will commit your patch (modulo the unneeded global statement) without tests (but after manual testing) unless someone objects. -- assignee: - eric.araujo ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue9741 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue12335] pysetup create will clobber an existing setup.cfg
Éric Araujo mer...@netwok.org added the comment: Well, create is not update :) In its current form, create will save an existing setup.cfg as setup.cfg.old and generate a new one. The human operator will then have to merge both files if necessary. Automatically merging the old file into the new one would raise issues with respect to comments, whitespace and all that in Pythons 3.2. The doc and help messages are probably unclear about that. -- assignee: - tarek components: +Distutils2 -Library (Lib) nosy: +alexis, eric.araujo, tarek ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue12335 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue9674] make install DESTDIR=/home/blah fails when the prefix specified is /
Éric Araujo mer...@netwok.org added the comment: Thanks. Have you run the test suite to make sure this doesn’t add bugs? -- assignee: tarek - eric.araujo components: -Build, Installation, Library (Lib) stage: - test needed type: compile error - behavior versions: +Python 3.3 -Python 3.1 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue9674 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue12335] pysetup create will clobber an existing setup.cfg
Barry A. Warsaw ba...@python.org added the comment: On Jun 15, 2011, at 02:04 PM, Éric Araujo wrote: Well, create is not update :) In its current form, create will save an existing setup.cfg as setup.cfg.old and generate a new one. The human operator will then have to merge both files if necessary. Automatically merging the old file into the new one would raise issues with respect to comments, whitespace and all that in Pythons 3.2. The doc and help messages are probably unclear about that. I missed the setup.cfg.old. I think that's fine. Probably `create` should print a message that it moved setup.cfg to setup.cfg.old. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue12335 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue12335] pysetup create will clobber an existing setup.cfg
Tarek Ziadé ziade.ta...@gmail.com added the comment: I find this behavior a bit awkward. Maybe we should ask first if it's ok to create a new setup.cfg and rename the old one, *before* doing it. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue12335 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue12335] pysetup create: ask before moving an existing setup.cfg
Éric Araujo mer...@netwok.org added the comment: Maybe we should ask first if it's ok to create a new setup.cfg and rename the old one, *before* doing it. Agreed, if “yes” is the default answer. -- title: pysetup create will clobber an existing setup.cfg - pysetup create: ask before moving an existing setup.cfg type: - feature request ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue12335 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue12314] regrtest checks (os.environ, sys.path, etc.) are hard to use
Michael Foord mich...@voidspace.org.uk added the comment: I don't think this is something that belongs in unittest - it's not something particularly useful (or at least particularly requested) outside of the python test suite. No reason that a WatchfulTestRunner couldn't live in regrtest. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue12314 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue11934] build with --prefix=/dev/null and zlib enabled in Modules/Setup failed
ysj.ray ysj@gmail.com added the comment: Isn’t zlib built by setup.py anyway? If can be build by Modules/Setup first as a builtin module, then the setup.py woun't build it. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue11934 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1711800] SequenceMatcher bug with insert/delete block after replace
Peter Waller peter.wal...@gmail.com added the comment: Apologies for the bump, but it has been more than a year and I did attach a patch! :-) What next? -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue1711800 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue8668] Packaging: add a 'develop' command
Changes by Peter Waller peter.wal...@gmail.com: -- nosy: +Peter.Waller ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue8668 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue12314] regrtest checks (os.environ, sys.path, etc.) are hard to use
R. David Murray rdmur...@bitdance.com added the comment: Sounds like a plan. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue12314 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue12340] Access violation when using the C version of the io module
New submission from OscarL oscar.le...@gmail.com: This is on Windows XP SP2. Using Python 2.7.1 and 2.7.2. While executing the unit tests of the PySerial package, version 2.5 (http://pypi.python.org/pypi/pyserial) one of the tests fails when using the C version of the io module (io), but pass if the pure Python version is used (_pyio.py). The specific test case in question is: test_iolib.py. When executed like: python test_iolib.py loop:// the test fails with the following traceback: Traceback (most recent call last): File C:\pyserial-2.5\test\test_iolib.py, line 68, in test_hello_raw self.failUnlessEqual(hello, unicode(hello\n)) AssertionError: u'memory at 0x00C5D940' != u'hello\n' And Windows shows a crash report dialog, with the following information: AppName: python.exe AppVer: 0.0.0.0 ModName: python27.dll ModVer: 2.7.2150.1013Offset: 00089f57 Exception Information Code: 0xc005Flags: 0x Record: 0x Address: 0x1e089f57 As said above, if in the said test case, instead of import io one does import _pyio as io, the crash does not happens, and the test succeeds. -- components: IO messages: 138382 nosy: OscarL priority: normal severity: normal status: open title: Access violation when using the C version of the io module type: crash versions: Python 2.7 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue12340 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1711800] SequenceMatcher bug with insert/delete block after replace
R. David Murray rdmur...@bitdance.com added the comment: No need to apologize for the bump. The trick is catching the interest of someone who feels qualified to judge the patch. I've added a couple people to nosy who worked on difflib recently. If no one speaks up in the next few days, it might be time to post to python-dev. -- nosy: +eli.bendersky, r.david.murray, terry.reedy ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue1711800 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue12340] Access violation when using the C version of the io module
Changes by R. David Murray rdmur...@bitdance.com: -- nosy: +pitrou ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue12340 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue11435] Links to source code should now point to hg repo
Éric Araujo mer...@netwok.org added the comment: The 2.7 docs link to the Subversion repo. Can I update them? -- nosy: +eric.araujo versions: +Python 2.7 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue11435 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue11102] configure doesn't find major() on HP-UX v11.31
R. David Murray rdmur...@bitdance.com added the comment: Well, one way might be to set up and maintain an HP/UX buildbot :) Other than that, just keep bugging us periodically until someone gets around to doing it. -- nosy: +r.david.murray stage: - commit review type: - compile error ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue11102 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue12341] Some additions to .hgignore
New submission from Sandro Tosi sandro.t...@gmail.com: following http://docs.python.org/devguide/coverage.html doc you'll end up with several new files/dirs in your checkout: - .coverage, used by coveragepy to save its info - coverage/ , the symlink to coveragepy/coverage - htmlcov/ , the dir where the coverage HTML pages are written I think they should be added to .hgignore so that hg st won't show them, and the attached patch just does it. It's meant for 'default' but should there be no problem to backport it to previous branches. -- assignee: sandro.tosi components: None files: hgignore_additions-default.patch keywords: patch messages: 138386 nosy: sandro.tosi priority: low severity: normal stage: patch review status: open title: Some additions to .hgignore type: behavior versions: Python 3.3 Added file: http://bugs.python.org/file22371/hgignore_additions-default.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue12341 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue12341] Some additions to .hgignore
Changes by Michael Foord mich...@voidspace.org.uk: -- nosy: +michael.foord ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue12341 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1711800] SequenceMatcher bug with insert/delete block after replace
Terry J. Reedy tjre...@udel.edu added the comment: I believe this issue should be closed and have set it to pending. The original report of a 'bug' and the two 'testcases' were and are invalid as they are based on an incorrect understanding of SequenceMatcher. It is not a diff program and in particular not a line diff program but the function used internally by such. It works on sequences of characters, lines, numbers, or anything else. Given the character strings 'abc' and 'abcd\def' it correctly reports that the second is a copy of 3 chars from the first plus insertion of 5 more. Gabriel correctly suggested the above in suggesting that if one wants to compare sequences of text lines, one might use Differ. One could also use SequenceMatcher directly, but this loses the diff-like formatting and report of within-line differences. I think this issue should have been closed then. I do not know what functionality Andrew thinks Christian was talking about. Using Differ with a = ['abc\n'] b = ['abcd\n', 'def\n'] for line in difflib.Differ().compare(a,b): print(line, end='') # prints - abc + abcd ?+ + def One line is replaced with two, with the extra info that the first new line is the old line with an extra char. I do not believe that 'any diffing program' will report the latter. The '?' lines are easily filtered out if not wanted. The patch by Peter has no motivation that I can see other than the idea that replacing a subsequence with one of a different length is somehow bad. Tim Peters did not think so and neither do I -- or Guido. Unequal replacement is built into the syntax of Python: s = [1,2,3] s[1:2] = [4,5,6] s [1, 4, 5, 6, 3] I would not be surprised it the proposed change broke some existing application or degraded performance a bit. -- assignee: tim_one - resolution: - invalid status: open - pending ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue1711800 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1711800] SequenceMatcher bug with insert/delete block after replace
Changes by Raymond Hettinger raymond.hettin...@gmail.com: -- status: pending - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue1711800 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue12191] Add shutil.chown to allow to use user and group name (and not only uid/gid)
Sandro Tosi sandro.t...@gmail.com added the comment: Here's the updated patch following review on Rietveld -- Added file: http://bugs.python.org/file22372/shutil_chown-default-v3.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue12191 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue12342] characters with ord above 65535 fail conversion with str.format for '{:c}' in IDLE
New submission from wujek wujek.sru...@googlemail.com: The following code produces an exception: print('{:c}'.format(65536)) when executed in Idle 3.2. The stack trace: print('{:c}'.format(65536)) Traceback (most recent call last): File pyshell#149, line 1, in module print('{:c}'.format(65536)) File /usr/lib/python3.2/idlelib/PyShell.py, line 1231, in write self.shell.write(s, self.tags) File /usr/lib/python3.2/idlelib/PyShell.py, line 1213, in write OutputWindow.write(self, s, tags, iomark) File /usr/lib/python3.2/idlelib/OutputWindow.py, line 40, in write self.text.insert(mark, s, tags) File /usr/lib/python3.2/idlelib/Percolator.py, line 25, in insert self.top.insert(index, chars, tags) File /usr/lib/python3.2/idlelib/ColorDelegator.py, line 79, in insert self.delegate.insert(index, chars, tags) File /usr/lib/python3.2/idlelib/PyShell.py, line 316, in insert UndoDelegator.insert(self, index, chars, tags) File /usr/lib/python3.2/idlelib/UndoDelegator.py, line 81, in insert self.addcmd(InsertCommand(index, chars, tags)) File /usr/lib/python3.2/idlelib/UndoDelegator.py, line 116, in addcmd cmd.do(self.delegate) File /usr/lib/python3.2/idlelib/UndoDelegator.py, line 219, in do text.insert(self.index1, self.chars, self.tags) File /usr/lib/python3.2/idlelib/ColorDelegator.py, line 79, in insert self.delegate.insert(index, chars, tags) File /usr/lib/python3.2/idlelib/WidgetRedirector.py, line 104, in __call__ return self.tk_call(self.orig_and_operation + args) ValueError: unsupported character Seems to work fine in a terminal (Gnome-terminal in this case): print('{:c}'.format(0x1)) (my font doesn't have the glyph, but otherwise it works) Python version: print(sys.version) 3.2 (r32:88445, Mar 25 2011, 19:56:22) [GCC 4.5.2] Os: wujek@home:~$ uname -a Linux studio 2.6.38-8-generic #42-Ubuntu SMP Mon Apr 11 03:31:24 UTC 2011 x86_64 x86_64 x86_64 GNU/Linux wujek@home:~$ cat /etc/issue Ubuntu 11.04 -- components: IDLE, IO messages: 138389 nosy: wujek.srujek priority: normal severity: normal status: open title: characters with ord above 65535 fail conversion with str.format for '{:c}' in IDLE type: behavior versions: Python 3.2 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue12342 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue12342] characters with ord above 65535 fail to display in IDLE
R. David Murray rdmur...@bitdance.com added the comment: Judging from the stack trace, it isn't str.format that's failing, it's tk failing to display it. -- nosy: +r.david.murray, terry.reedy title: characters with ord above 65535 fail conversion with str.format for '{:c}' in IDLE - characters with ord above 65535 fail to display in IDLE ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue12342 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue10527] multiprocessing.Pipe problem: handle out of range in select()
Dave Malcolm dmalc...@redhat.com added the comment: [for reference: issue 11743 covered Antoine's rewrite of the connection class to be pure python, for 3.3 (re msg138310)] -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue10527 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue12342] characters with ord above 65535 fail to display in IDLE
STINNER Victor victor.stin...@haypocalc.com added the comment: U+1 is not the most common character in fonts. You should try another character in U+1-U+10 range (non-BMP characters). The new funny emoticon are in this range, but I don't know if your Ubuntu setup includes a font supporting this range. http://www.unicode.org/charts/PDF/Unicode-6.0/U60-1F600.pdf -- nosy: +haypo ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue12342 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue12133] ResourceWarning in urllib.request
STINNER Victor victor.stin...@haypocalc.com added the comment: Oh, I wrote a similar patch to kill the ResourceWarning of test_pypi_simple (except that I didn't patch test_urllib2). -- nosy: +haypo versions: +Python 2.7, Python 3.2 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue12133 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue10883] urllib: socket is not closed explicitly
STINNER Victor victor.stin...@haypocalc.com added the comment: Is there still something to do in this issue? The initial report is fixed. -- versions: -Python 2.6, Python 3.1 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue10883 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue12342] characters with ord above 65535 fail to display in IDLE
Ned Deily n...@acm.org added the comment: From the discussions here, http://wiki.tcl.tk/1364, it appears that Tcl 8.5 (and earlier) does not support Unicode code points outside the BMP range as in this example. I don't think there is anything practical IDLE or tkinter can do about that. -- nosy: +ned.deily ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue12342 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue12167] test_packaging reference leak
Roundup Robot devnull@devnull added the comment: New changeset fd6446a88fe3 by Victor Stinner in branch 'default': Issue #12167: Fix a reafleak in packaging.tests.PyPIServer constructor http://hg.python.org/cpython/rev/fd6446a88fe3 -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue12167 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com