Re: timezone argument %z and %Z

2014-08-15 Thread Ben Finney
luofeiyu writes: > In my system : win7+ python3.4 . AFAIK, Microsoft's Windows OS does not provide correct standard timezones for programmers. They provide only proprietary data, which do not match the international standard time zones. You will need to install timezone support specifically for

timezone argument %z and %Z

2014-08-15 Thread luofeiyu
I feel it is necessary to start a new post to go on the discussion about timezone. In my system : win7+ python3.4 . related official material. https://docs.python.org/3.4/library/datetime.html#strftime-and-strptime %z UTC offset in the form +HHMM or -HHMM (empty string if the the object is na

Re: redirect stderr to syslog?

2014-08-15 Thread Steven D'Aprano
Russell E. Owen wrote: > I realize the logging module supports this and has a syslog writer, so > that's a fallback. But we were hoping to use the syslog module for > performance. Have you benchmarked your code and discovered that using the logging module makes a noticeable difference to performa

Re: string encoding regex problem

2014-08-15 Thread Steven D'Aprano
Philipp Kraus wrote: > The code works till last week correctly, I don't change the pattern. My > question is, can it be > a problem with string encoding? Did I mask the question mark and quotes > correctly? If you didn't change the code, how could the *exact same code* not mask the question mark

redirect stderr to syslog?

2014-08-15 Thread Russell E. Owen
We are using the syslog module for logging, and would like to redirect stderr to our log. Is there a practical way to do it? I realize the logging module supports this and has a syslog writer, so that's a fallback. But we were hoping to use the syslog module for performance. -- Russell -- ht

Re: string encoding regex problem

2014-08-15 Thread Roy Smith
In article , Philipp Kraus wrote: > The code works till last week correctly, I don't change the pattern. OK, so what did you change? Can you go back to last week's code and compare it to what you have now to see what changed? > My question is, can it be a problem with string encoding? Did I

Re: string encoding regex problem

2014-08-15 Thread Philipp Kraus
On 2014-08-16 00:48:46 +, Roy Smith said: In article , Philipp Kraus wrote: found = re.search( "http://sourceforge.net/projects/boost/files/boost/";) ) if found == None : raise MyError.StopError("Boost Download URL not found") But found is always None, so I cannot get the correc

Re: string encoding regex problem

2014-08-15 Thread Roy Smith
In article , Philipp Kraus wrote: > found = re.search( " href=\"/projects/boost/files/latest/download\?source=files\" > title=\"/boost/(.*)", > Utilities.URLReader("http://sourceforge.net/projects/boost/files/boost/";) > ) > if found == None : > raise MyError.StopError("Boost Download U

string encoding regex problem

2014-08-15 Thread Philipp Kraus
Hello, I have defined a function with: def URLReader(url) : try : f = urllib2.urlopen(url) data = f.read() f.close() except Exception, e : raise MyError.StopError(e) return data which get the HTML source code from an URL. I use this to get a part of a HTML

Logging multiple formats to the same file

2014-08-15 Thread Rob Gaddi
So I've got my program log going to a RotatingFileHandler (actually a subclass that ensmartens the umask, but I digress). I'd like to be able to provide information to the logger that is formatted two different ways, primarily just so that I can provide a Program Started message into the log. Wha

Re: get the min date from a list

2014-08-15 Thread Ian Kelly
On Fri, Aug 15, 2014 at 12:21 PM, Denis McMahon wrote: > Output is a sorted list of the actual times and the UTC equivalents of > all the times in the original list. Note that I had to edit several > strings in your times list to ensure they were all in identical format: I > added leading 0s to nu

Re: PyMatch Tool.

2014-08-15 Thread Christian Gollwitzer
Am 14.08.14 21:50, schrieb rafinha.u...@gmail.com: Hello, I created this tool to help me develop on formatting text using regular expressions. Any questions, I am available. Thank you. Tool -> https://github.com/rfunix/PyMatch I expected something like visual regexp: http://laurent.r

Re: get the min date from a list

2014-08-15 Thread Mark Lawrence
On 15/08/2014 19:21, Denis McMahon wrote: On Thu, 14 Aug 2014 22:10:36 +0800, luofeiyu wrote: I finished it ,but how to make it into more pythonic way such as min (dates, key = converter) 1. If you don't learn to post properly, I'm going to stop trying to help you. I say old bean do be car

Re: Unicode in cgi-script with apache2

2014-08-15 Thread John Gordon
In Dominique Ramaekers writes: > #!/usr/bin/env python3 > print("Content-Type: text/html") > print("Cache-Control: no-cache, must-revalidate")# HTTP/1.1 > print("Expires: Sat, 26 Jul 1997 05:00:00 GMT") # Date in the past > print("") > f = open("/var/www/cgi-data/index.html", "r") > for lin

Re: Unicode in cgi-script with apache2

2014-08-15 Thread alister
On Fri, 15 Aug 2014 20:10:25 +0200, Dominique Ramaekers wrote: > Hi, > > I've got a little script: > > #!/usr/bin/env python3 print("Content-Type: text/html") > print("Cache-Control: no-cache, must-revalidate")# HTTP/1.1 > print("Expires: Sat, 26 Jul 1997 05:00:00 GMT") # Date in the past >

Unicode in cgi-script with apache2

2014-08-15 Thread Dominique Ramaekers
Hi, I've got a little script: #!/usr/bin/env python3 print("Content-Type: text/html") print("Cache-Control: no-cache, must-revalidate")# HTTP/1.1 print("Expires: Sat, 26 Jul 1997 05:00:00 GMT") # Date in the past print("") f = open("/var/www/cgi-data/index.html", "r") for line in f: prin

Re: get the min date from a list

2014-08-15 Thread Denis McMahon
On Thu, 14 Aug 2014 22:10:36 +0800, luofeiyu wrote: > I finished it ,but how to make it into more pythonic way such as min > (dates, key = converter) 1. If you don't learn to post properly, I'm going to stop trying to help you. 2. To user strptime, you need to have all the time strings in the s

Re: timedelta problem

2014-08-15 Thread Ian Kelly
On Fri, Aug 15, 2014 at 11:43 AM, Denis McMahon wrote: > On Fri, 15 Aug 2014 09:23:02 -0600, Ian Kelly wrote: > >> On Fri, Aug 15, 2014 at 1:39 AM, Denis McMahon >> wrote: >>> On Fri, 15 Aug 2014 10:24:47 +0800, luofeiyu wrote: >>> >>> On further inspection, it seems that strptime() in 2.7 doesn'

Re: timedelta problem

2014-08-15 Thread Denis McMahon
On Fri, 15 Aug 2014 09:23:02 -0600, Ian Kelly wrote: > On Fri, Aug 15, 2014 at 1:39 AM, Denis McMahon > wrote: >> On Fri, 15 Aug 2014 10:24:47 +0800, luofeiyu wrote: >> >> On further inspection, it seems that strptime() in 2.7 doesn't handle >> %z at all. In 3.2, it ignores the value it gets, bec

Re: Captcha identify

2014-08-15 Thread Chris Angelico
On Sat, Aug 16, 2014 at 3:18 AM, Eric S. Johansson wrote: > not what I said or advocated. pointing out that breaking captchas is good > for accessibility issues it not the same as being pro spambot. it may have > that effect but it is not the same thing. I don't care, frankly. I'm still not goin

Re: problem on top-post

2014-08-15 Thread John Gordon
In Ben Finney writes: > "Bottom-post" usually refers to the inferior practice of quoting a > message (entirely or large amounts) and then indiscriminately responding > to all of it below all of the quoted text. I was unaware of that meaning. -- John Gordon Imagine what it must be lik

Re: Captcha identify

2014-08-15 Thread Eric S. Johansson
On 8/14/2014 7:19 PM, Denis McMahon wrote: On Wed, 13 Aug 2014 07:39:20 -0400, Eric S. Johansson wrote: you are clear but also missing a really good reason to break captchas. handicapped accessibility. Captchas are a huge barrier to access and in many cases push disabled users away from using

Re: timedelta problem

2014-08-15 Thread Mark Lawrence
On 15/08/2014 16:23, Ian Kelly wrote: On Fri, Aug 15, 2014 at 1:39 AM, Denis McMahon wrote: On Fri, 15 Aug 2014 10:24:47 +0800, luofeiyu wrote: On further inspection, it seems that strptime() in 2.7 doesn't handle %z at all. In 3.2, it ignores the value it gets, because there's no practical wa

Re: timedelta problem

2014-08-15 Thread Ian Kelly
On Fri, Aug 15, 2014 at 1:39 AM, Denis McMahon wrote: > On Fri, 15 Aug 2014 10:24:47 +0800, luofeiyu wrote: > > On further inspection, it seems that strptime() in 2.7 doesn't handle %z > at all. In 3.2, it ignores the value it gets, because there's no > practical way to select the "right" tz strin

Re: Captcha identify

2014-08-15 Thread Michael Torrie
On 08/13/2014 02:18 PM, Ian Kelly wrote: > On Wed, Aug 13, 2014 at 2:01 PM, Tim Chase > wrote: >> On 2014-08-13 12:24, Chris Kaynor wrote: >>> Many of the better captchas also include options for an audio cue in >>> addition to the default visual one. >> >> Have you actually tried to use the audio

Re: Matplotlib Contour Plots

2014-08-15 Thread Steven D'Aprano
Jamie Mitchell wrote: > I created the 2D array which read as: That's not a 2D array. When the amount of data you have is too big to clearly see what it happening, replace it with something smaller. Instead of 30 items per sub-array, try it with 5 items per sub-array. Instead of eight decimal pla

Re: python small task

2014-08-15 Thread ngangsia akumbo
CAN U BE VERY DETAILED PLEASEE -- https://mail.python.org/mailman/listinfo/python-list

Re: Matplotlib Contour Plots

2014-08-15 Thread Jamie Mitchell
On Friday, August 15, 2014 2:23:25 PM UTC+1, Steven D'Aprano wrote: > Jamie Mitchell wrote: > > > > [...] > > > I just want to get a contour plot of two numpy arrays. > > > When I call plt.contour on my data I get "input must be a 2D array" > > > > You are providing a 1D array, or possibly

Re: how to change the time string into number?

2014-08-15 Thread Denis McMahon
On Thu, 14 Aug 2014 14:52:17 +0800, luofeiyu wrote: > in the manual https://docs.python.org/3.4/library/time.html > > %zTime zone offset indicating a positive or negative time difference > from UTC/GMT of the form +HHMM or -HHMM, where H represents decimal hour > digits and M represents deci

Re: Matplotlib Contour Plots

2014-08-15 Thread Steven D'Aprano
Jamie Mitchell wrote: [...] > I just want to get a contour plot of two numpy arrays. > When I call plt.contour on my data I get "input must be a 2D array" You are providing a 1D array, or possibly a 3D array. So the question you really want to ask is not "How do I do contour plots" but "how do I

Re: python small task

2014-08-15 Thread Johannes Bauer
On 15.08.2014 11:18, ngangsia akumbo wrote: > i have this piece of code > > file1 = open('text.txt, w) > try: > text = file1.read() > finally: > file1.close() > > i wish to manage an office task using this small code , how can i implemetn > it to function. import random import troll i

Re: Matplotlib Contour Plots

2014-08-15 Thread Jamie Mitchell
On Thursday, August 14, 2014 5:53:09 PM UTC+1, Steven D'Aprano wrote: > Jamie Mitchell wrote: > > > > > Hello all, > > > > > > I want to contour a scatter plot but I don't know how. > > > > > > Can anyone help me out? > > > > Certainly. Which way did you come in? > > > > :-) > > >

Re: timedelta problem

2014-08-15 Thread Denis McMahon
On Fri, 15 Aug 2014 10:24:47 +0800, luofeiyu wrote: > problem : > > t1 is GMT time 2014 00:36:46 t2 is GMT time 2014 14:36:46 > > datetime.datetime.strptime do not give me the right answer. As far as I can tell from running the following, it all seems to work as expected in python 3.2 (

python small task

2014-08-15 Thread ngangsia akumbo
i have this piece of code file1 = open('text.txt, w) try: text = file1.read() finally: file1.close() i wish to manage an office task using this small code , how can i implemetn it to function. how can i pars it in a webpage ? -- https://mail.python.org/mailman/listinfo/python-list

Re: timedelta problem

2014-08-15 Thread Denis McMahon
On Fri, 15 Aug 2014 07:39:23 +, Denis McMahon wrote: > I've patched my 2.7 to set a tz string of "UTC[+-]" from the > [+-] %z value. ... but that doesn't do much, because time.struct_time in 2.7 doesn't recognise anything that strptime passes in as a tz at all, as it expects the dst

Re: get the min date from a list

2014-08-15 Thread Marko Rauhamaa
Mark Lawrence : > The rules here are quite clear, don't top post. If you can't be > bothered to adhere to the rules, don't post. Top-posting is bad, but I find nagging worse. Marko -- https://mail.python.org/mailman/listinfo/python-list

Re: Captcha identify

2014-08-15 Thread Mark Lawrence
On 15/08/2014 08:03, alex23 wrote: On 15/08/2014 5:43 AM, Eric S. Johansson wrote: On 8/14/2014 2:37 PM, Peter Pearson wrote: "Which of the following eight sentences are sarcastic in tone?" and responses on this list alone show problems with detecting sarcasm (or snark). It can be especiall

Re: get the min date from a list

2014-08-15 Thread Mark Lawrence
On 15/08/2014 01:56, Dan Stromberg wrote: On Thu, Aug 14, 2014 at 5:44 PM, Mark Lawrence wrote: I really don't understand why people here are spoon feeding you when you still insist on top posting. Ever heard the term "manners"? Oh what a stupid comment, obviously not. *plonk* Getting peop

Re: timedelta problem

2014-08-15 Thread Cameron Simpson
On 15Aug2014 13:59, Chris Angelico wrote: On Fri, Aug 15, 2014 at 1:51 PM, Denis McMahon wrote: AttributeError: 'module' object has no attribute 'timezone' Both fail as you describe in 2.7, but in 3.4/3.5ish (my 'python3' is a bit of a mess, but it's something between those two I think), bot

Re: timedelta problem

2014-08-15 Thread Denis McMahon
On Fri, 15 Aug 2014 10:24:47 +0800, luofeiyu wrote: On further inspection, it seems that strptime() in 2.7 doesn't handle %z at all. In 3.2, it ignores the value it gets, because there's no practical way to select the "right" tz string from the offset. For example, a dictionary of offset minute

Re: Captcha identify

2014-08-15 Thread alex23
On 15/08/2014 5:43 AM, Eric S. Johansson wrote: On 8/14/2014 2:37 PM, Peter Pearson wrote: "Which of the following eight sentences are sarcastic in tone?" and responses on this list alone show problems with detecting sarcasm (or snark). It can be especially difficult for people on the autism