Re: file.write() of non-ASCII characters differs in Interpreted Python than in script run

2015-08-27 Thread RAH
Dear All, The solution / explanation follows. Thanks to Graham Dumpleton, the author of mod_wsgi (the WSGI module for Apache2) the source of the problem could be traced back to variables in Apache2. Below are the details reproduced from https://groups.google.com/forum/#!topic/modwsgi/4wdfCOnMU

Re: file.write() of non-ASCII characters differs in Interpreted Python than in script run

2015-08-26 Thread RAH
On Wednesday, August 26, 2015 at 5:59:12 PM UTC+2, Chris Angelico wrote: > On Thu, Aug 27, 2015 at 1:02 AM, RAH wrote: > > 7) Now, that source of the problem is known, I must investigate why my > > run-time environment differs from the interpreter environment. I know it is >

Re: file.write() of non-ASCII characters differs in Interpreted Python than in script run

2015-08-26 Thread RAH
Dear All, First, thanks to each and everyone. There is indeed a solution by I haven't yet found the root of the problem (I'll come back to that at the end of my post). 1) After many trials and errors, I found that the problem was with the write() function in `h.write(str(d) + '\n')` and not wit

Re: file.write() of non-ASCII characters differs in Interpreted Python than in script run

2015-08-26 Thread RAH
Thank you Chris. I'll share my findings in a moment. Please bear with me a bit more time. Cheers, René -- https://mail.python.org/mailman/listinfo/python-list

Re: file.write() of non-ASCII characters differs in Interpreted Python than in script run

2015-08-26 Thread RAH
Dear Dieter, Indeed there is a difference. I will share my discoveries in a while after I respond to each one. Be in touch soon. Thanks. René -- https://mail.python.org/mailman/listinfo/python-list

Re: file.write() of non-ASCII characters differs in Interpreted Python than in script run

2015-08-26 Thread RAH
Thank you Pete. Indeed it has to do with choice of encoding. I'll be back in a short while with more details. Cheers, René -- https://mail.python.org/mailman/listinfo/python-list

Re: file.write() of non-ASCII characters differs in Interpreted Python than in script run

2015-08-26 Thread RAH
Dear Chris, Thank you. I got the answer (at least a partial one) that I will share in a while. I will first respond to the other posts I received to thank each and everyone. Please stay tuned. René -- https://mail.python.org/mailman/listinfo/python-list

Re: file.write() of non-ASCII characters differs in Interpreted Python than in script run

2015-08-26 Thread RAH
Dear Chris, I can confirm it is Python 3. Here is the line from the Apache2 log: [Wed Aug 26 10:28:01.508194 2015] [mpm_worker:notice] [pid 1120:tid 3074398848] AH00292: Apache/2.4.7 (Ubuntu) OpenSSL/1.0.1f mod_wsgi/4.4.13 Python/3.4.0 configured -- resuming normal operations As a matter of fac

file.write() of non-ASCII characters differs in Interpreted Python than in script run

2015-08-25 Thread RAH
Dear All, I experienced an incomprehensible behavior (I've spent already many hours on this subject): the `file.write('string')` provides an error in run mode and not when interpreted at the console. The string must contain non-ASCII characters. If all ASCII, there is no error. The following e

Loop Iteration

2005-12-21 Thread RaH
Hello. I am writing a script to parse my logfiles to monitor sshd attempted logins. I know I'm reinventing the wheel, but it's something I want to do. The problem I am having is that upon the 4th or 5th pass in my for statement I recieve an error AttributeError: 'NoneType' object has no attribute