Re: Unicode in cgi-script with apache2

2014-08-16 Thread Steven D'Aprano
Dominique Ramaekers wrote: [...] > 2) Your tip, to use 'encode' did not solve the problem and created a new > one. My lines were incapsulted in quotes and I got a lot of \b's and > \n's... and I still got the same error. Just throwing random encode/decode calls into the mix are unlikely to fix th

Re: Unicode in cgi-script with apache2

2014-08-16 Thread Dominique Ramaekers
* My system is a linux-box. * I've tried using encoding="utf-8". It didn't fix things. * That print uses sys.stdout would explain, using sys.stdout isn't better. * My locale and the system-wide locale is UTF-8. Using SetEnv PYTHONIOENCODING utf-8 didn't fix things * The file is encoded UTF-8

Re: Unicode in cgi-script with apache2

2014-08-16 Thread Denis McMahon
On Sun, 17 Aug 2014 00:36:14 +0200, Dominique Ramaekers wrote: > What seems to be the problem: > My Script was ok. I know this because in the terminal I got my expected > output. Python3 uses UTF-8 coding as a standard. The problem is, when > python 'prints' to the apache interface, it translates

Re: Unicode in cgi-script with apache2

2014-08-16 Thread Dominique Ramaekers
Hi Denis, This error is a python error displayed in the apache error log. The complete message is: [Sat Aug 16 23:12:42.158326 2014] [cgi:error] [pid 29327] [client 119.63.193.196:0] AH01215: Traceback (most recent call last): [Sat Aug 16 23:12:42.158451 2014] [cgi:error] [pid 29327] [clien

Re: Unicode in cgi-script with apache2

2014-08-16 Thread Dominique Ramaekers
Hi Peter, Your code seems interesting. I've tried using sys.stdout (in a slightly different form) but it gave the same error. I also read about people who fixed the error by changing the servers locale to en_US.UTF-8. The people who posted these fixes also said that you can only use en_US.U

Re: Unicode in cgi-script with apache2

2014-08-16 Thread Dominique Ramaekers
Hi John, The error is in the line "print(line,end='')"... and it only happens when the script is started from a webbrowser. In the terminal, the script works fine. See my previous mail for my findings after a lot of reading and trying... grz Op 15-08-14 om 21:32 schreef John Gordon: In D

Re: Unicode in cgi-script with apache2

2014-08-16 Thread Dominique Ramaekers
I fond my problem, I will describe it more at the bottom of this message... But first... Thanks Alister for the tips: 1) This evening, I've researched WSGI. I found that WSGI is more advanced than CGI and I also think WSGI is more the Python way. I'm an amateur playing around with my imaginati

Re: Topological Overlap

2014-08-16 Thread lavanya addepalli
Hello It is not a homework really. Actually it is a huge project and topological overlap is one part in that inputfile: 0_node_1 0_node_2 w0 1_node_1 1_node_2 w1 2_node_1 2_node_2 w2 3_node_1 3_node_2 w3 4_node_1 4_node_2 w4 5_node_1 5_node_2 w5 2 nodes in pair and w is the weight. I have

Re: Topological Overlap

2014-08-16 Thread George Silva
Homework? You need to give us a start, sample of the data and an actual question. I don't think many people will help you do your homework for you. On Sat, Aug 16, 2014 at 7:32 AM, lavanya addepalli wrote: > Hello > > I have a file with network node pairs and weights as time difference > I am

Re: Unicode in cgi-script with apache2

2014-08-16 Thread Denis McMahon
On Fri, 15 Aug 2014 20:10:25 +0200, Dominique Ramaekers wrote: > #!/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-dat

Re: Unicode in cgi-script with apache2

2014-08-16 Thread Peter Otten
Dominique Ramaekers wrote: > 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/ind

Topological Overlap

2014-08-16 Thread lavanya addepalli
Hello I have a file with network node pairs and weights as time difference I am trying to find the topological overlap of that data I have been searching for any sample in python but i dont seem to find any. Any suggestion in start with are appreciated Thanks Lav -- https://mail.python.org/ma

Re: redirect stderr to syslog?

2014-08-16 Thread Roy Smith
In article <53eee06a$0$29984$c3e8da3$54964...@news.astraweb.com>, Steven D'Aprano wrote: > 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 be

Re: string encoding regex problem

2014-08-16 Thread Peter Otten
Philipp Kraus wrote: > The code works till last week correctly, I don't change the pattern. Websites' contents and structure change sometimes. > My question is, can it be a problem with string encoding? Your regex is all-ascii. So an encoding problem is very unlikely. > found = re.search( "

Re: timezone argument %z and %Z

2014-08-16 Thread Chris Angelico
On Sat, Aug 16, 2014 at 6:21 PM, Ian Kelly wrote: > You should also be aware that the abbreviations do not always uniquely > identify a time zone. For example, "EST" is used in both North America > (-0500) and Australia (+1000). It's usually better just to use time zone > offsets to avoid this sor

Re: timezone argument %z and %Z

2014-08-16 Thread Ian Kelly
On Sat, Aug 16, 2014 at 12:48 AM, Ben Finney wrote: > > problem 1: > > There are 24 time zone in the world, does any time zone has the time > > zone name such as EST,CST ? > > Are there 24 time zone abbreviations in python ?what are other 22 > > except for EST ,CST ? > > There are *many* time

Re: redirect stderr to syslog?

2014-08-16 Thread Terry Reedy
On 8/15/2014 11:04 PM, Russell E. Owen wrote: 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? You can replace sys.stderr with any object with a .write(s) method. -- Terry Jan Reedy -- https://mail.python.org/mailman