On 14 October 2011 03:01, p.schneider
<[email protected]> wrote:
>
>
> On 12 Okt., 23:54, Graham Dumpleton <[email protected]>
> wrote:
>> On 13 October 2011 08:36, p.schneider
>>
>> <[email protected]> wrote:
>> > Hello,
>>
>> > Im trying to setup mod_wsgi with python3.2 for 3 days now but it
>> > seems, I reached a dead-end.
>>
>> > my test-wsgi-program (nearly 1:1 from tutorial):
>> > import sys
>> > sys.stdout = sys.stderr
>>
>> Don't change sys.stdout line that, it is not needed.
>>
>
> I got this from http://code.google.com/p/modwsgi/wiki/DebuggingTechniques:
> "If 'wsgi.errors' is not available to the code which needs to output
> log messages, then it should explicitly direct output from the 'print'
> statement to 'sys.stderr'. "
> Some kind of Cargo cult programming but seemed feasible enough for me.

It says:

"""Do be aware though that writing to sys.stdout is by default
restricted in versions of mod_wsgi prior to 3.0 and will result in an
exception occurring of the form:"""

So, reassigning stdout is not needed from 3.0 onwards.

Graham

>> > def application(environ, start_response):
>> >    status = '200 OK'
>> >    output = 'Hello World!'
>>
>> This is not a valid Python 3.X WSGI application. The output must be
>> bytes, not a unicode string.
>>
>> Use:
>>
>>   output = b'Hello World!'
>>
>
> That was the trick. Now I see my `Hello World' :D
>
>> >    response_headers = [('Content-type', 'text/plain'),
>> >                        ('Content-Length', str(len(output)))]
>> >    start_response(status, response_headers)
>> >    print("still alive")
>> >    return [output]
>>
>> > I see the `still allive' in apache-error-log but nothing else on
>> > notice-level. The apache-conf is bloated up but I think its okay.. the
>> > application itself is reachable.
>>
>> Did you check both main Apache error log and any virtual host error log file?
>>
>
> There is none configured for my vhost.
>
>> > my setup (its a server we rent,  its everything but not up-to-date):
>> > mod_wsgi (checked out from repository and compiled manualy two days
>> > ago)
>> > python3.2m (compiled manualy, released on python-website)
>> > CentOs 5.5 (Linux 2.6.18)
>>
>> > I need to replace every occurence of PyInt_FromLong with
>> > PyLong_FromLong to make it compile. Otherwise I got a linker-error.
>> > Might this indicate the real problem?
>>
>> I fixed that yesterday, but hadn't committed change as I didn't think
>> I had committed the original code where I had the wrong code in the
>> first place. :-)
>>
>> Is unrelated.
>>
>> Graham
>
> Thank you for your help. Seems, I need to read some docs more
> carefully. I'm used to python2.x and havent done anything with wsgi
> before.. a long way to go ;)
>
> best regards
> Peter
>
> --
> You received this message because you are subscribed to the Google Groups 
> "modwsgi" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to 
> [email protected].
> For more options, visit this group at 
> http://groups.google.com/group/modwsgi?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"modwsgi" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/modwsgi?hl=en.

Reply via email to