views:

85

answers:

2

It is a rather strange 'bug'.

I have written a cherrypy based server. If I run it this way:

python simple_server.py > out.txt

It works as expected.

Without the the redirection at the end, however, the server will not accept any connection at all.

Anyone has any idea?

I am using python 2.4 on a Win XP professional machine.

+1  A: 

Are you running the script in an XP "command window"? Otherwise (if there's neither redirection nor command window available), standard output might simply be closed, which might inhibit the script (or rather its underlying framework).

Alex Martelli
Thanks Alex for your reply. I always enjoy your talks on Google techtalk and your posts here.To answer your question, I run it in a Command Prompt windows.
Anthony Kong
A: 

CherryPy runs in a "development" mode by default, which includes logging startup messages to stdout. If stdout is not available, I would assume the server is not able to start successfully.

You can change this by setting 'log.screen: False' in config (and replacing it with 'log.error_file: "/path/to/error.log"' if you know what's good for you ;) ). Note that the global config entry 'environment: production' will also turn off log.screen.

fumanchu