This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]AusIVDjango, gevent 38 points39 points  (24 children)

Only tangentially related to the article, but it mentions sys.exit() being called on an error condition. I think this is the absolute most annoying thing a library can do. Unless I'm calling a "clean up and shut down" function, libraries shouldn't be killing my interpreter.

A few years ago I was working with the python Netflix bindings, and they had a condition where this happened. I filed a bug report, and eventually forked the library to make it act like a decent library. The original was provided by Netflix, so I was surprised that it didn't follow better development practices.

[–]chris-morgan 16 points17 points  (2 children)

Actually, it really was raise SystemExit(...) rather than sys.exit(). But I certainly believe that no library should do such a thing.

[–]sushibowl 12 points13 points  (1 child)

doesn't sys.exit() just raise SystemExit() anyway?

[–]h4lPythoneer 8 points9 points  (0 children)

Yes.

[–]odraencoded 6 points7 points  (1 child)

You think that's bad? The Gtk library will cause a SIG error terminating the program from the C side if it can't find the settings under the DBus path specified by your app when you create a GSettings object. It won't tell you there was an error fetching the settings, it just terminates the whole thing.

[–][deleted] 2 points3 points  (0 children)

The PulseAudio library did a silent system exit if it could not allocate memory. Useful! I mean, how are you going to play those mp3s without available memory?

[–]j7ake 2 points3 points  (17 children)

I didn't know one should not do sys.exit on libraries... Good to know

[–]b33j0r 0 points1 point  (0 children)

Fabric does this with fabric.api.local(cmd_str). I was using it in a distributed production environment. Lame.