[Twisted-Python] run python application with twistd -y ifinger.tac, error occurs. please help to check

exarkun at twistedmatrix.com exarkun at twistedmatrix.com
Tue Sep 17 12:08:37 MDT 2013


On 04:10 pm, _ at lvh.io wrote:
>On Tue, Sep 17, 2013 at 2:14 PM, <exarkun at twistedmatrix.com> wrote:
>>I think there are still many unported dependencies of `twistd` to port
>>first.
>
>Sure, but every little bit helps, right? :)

It doesn't make a lot of sense to me to port things that depend on 
unported things.  The little bit that would help would be porting one of 
the unported dependencies.
>
>>  Can someone comment as to why this was put there in the first place, 
>>and,
>>>specifically, why it can't just be "pass"? Is there some logging 
>>>system
>>>that looks at the current exception or something when twistd (or some
>>>other
>>>script) starts?
>>
>>Both `log.err()´ and `Failure()´ look at the current exception.  If we
>>don't `sys.clear_exc()´ here then the first piece of code that tries 
>>to use
>>either of those may get a surprising result.  The current exception 
>>state
>>can last a long time so this surprise can hide for a remarkably long 
>>time
>>before showing up.
>
>Okay, cool. From what I understand:
>
>1. _preamble is just a hack to get bin/whatever to work right without
>installing (i.e. from a checkout)
>2. (not too sure about this) in py3k, except statements do the clearing 
>bit
>already: www.python.org/dev/peps/pep-3110/#semantic-changes
>
>So, does that mean we can do a try: ... ; except AttributeError and be 
>done
>with it?

Sounds like probably yea.  The way to know would be to make the change 
and run the test suite (perhaps first double checking to get an idea of 
how well covered this is).  Revision history suggests the change was 
made to get a test to pass but it doesn't mention which one.

This is why porting the dependencies first makes sense though - you 
won't be able to run the tests as long as the dependencies are unported.

Jean-Paul



More information about the Twisted-Python mailing list