[Twisted-Python] How do I debug this network problem?

Peter Westlake peter.westlake at pobox.com
Sat Nov 22 09:11:07 MST 2014


>
> Closing stdin is probably the best option here, but the original
> problem was caused by a mixing of levels.
>
> On one level, you've got open(), which wants to sort of pretend that
> an open file is an object, and that the operating system resource
> involved is an implementation detail that can be cleaned up by the
> garbage collector.
>
> On the other level, you've got spawnProcess, which is operating
> entirely in terms of file descriptors as process-global state.
>
> Any time you want to open a file descriptor for spawnProcess to
> consume, I suggest that you open it with os.open
> <https://docs.python.org/2/library/os.html#os.open>, which just hands
> you an integer and makes it your own problem to close it explicitly
> with os.close <https://docs.python.org/2/library/os.html#os.close>;
> this is operating at the same abstraction level and therefore less
> error-prone.

That's useful to know, thanks. I'll remember it for next time!

Peter.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: </pipermail/twisted-python/attachments/20141122/2a3d5fa1/attachment-0002.html>


More information about the Twisted-Python mailing list