[pygr-notify] Issue 37 in pygr: run XMLRPC server in a separate thread by default

codesite-noreply at google.com codesite-noreply at google.com
Mon Apr 13 12:23:40 PDT 2009


Comment #12 on issue 37 by marecki: run XMLRPC server in a separate thread  
by default
http://code.google.com/p/pygr/issues/detail?id=37

Hmm, I'm not sure whether removing the ps1 check is a good idea... Let me  
explain.
AFAIK there are three scenarios of running the server with demonise=False:
  (1) start an interactive Python session, type in the invocation; this will  
keep the
server running as long as the session isn't manually terminated;
  (2) 'python scriptname' or something like that, in which case the  
(non-interactive)
session is terminated as soon as EOF is reached in the script input -  
taking the
server with it right after it started;
  (3) 'python -i scriptname' or something like that, in which case the non-
interactive session turns interactive as soon as EOF is reached in the  
script input
- keeping the server running as long as the interactive session isn't  
manually
terminated.

According to Python mailing list, _hasattr(sys, 'ps1')_ is a de-facto  
standard way
of detecting whether a Python session is interactive or not, thus making  
sure the
warning message is not printed in case (1). It doesn't work for (3) because  
ps1 is
only set AFTER the script has been run. Thus, we end up with the following  
behaviour:
  (1) run without hassle - as expected;
  (2) warn the user about dying, then die - as expected;
  (3) warn the user about dying, then NOT die - a false negative

Removing the check on the other hand means we've got a warning produced  
every time
the server starts in non-daemon mode, which means we've got two false  
negatives
rather than one.

--
You received this message because you are listed in the owner
or CC fields of this issue, or because you starred this issue.
You may adjust your issue notification preferences at:
http://code.google.com/hosting/settings



More information about the pygr-notify mailing list