It's not a secret anymore!*
The moose likes Linux / UNIX and the fly likes Linux Query Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Engineering » Linux / UNIX
Bookmark "Linux Query" Watch "Linux Query" New topic
Author

Linux Query

Gracey Smith
Greenhorn

Joined: Mar 05, 2009
Posts: 2
Hello,
I was wondering how i catch various signals in nix python so i can exit my programs gracefully? Please reply my post if you know the answer.

Thanks


Embroidered Logos
T Shirts Printing
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 16019
    
  20

Python has something resembling the Java try/catch mechanism. There's a very good online guide to Python and a whole chapter on the topic.


Customer surveys are for companies who didn't pay proper attention to begin with.
Alisha Smith
Greenhorn

Joined: Mar 27, 2009
Posts: 2
Gracey Smith wrote:Hello,
I was wondering how i catch various signals in nix python so i can exit my programs gracefully? Please reply my post if you know the answer.

Thanks


Simply "import signal", and see documentation of that module. But bear in mind that signals are weird with Python. The atomic unit of Python execution can span a C external function call, and that can take an indefinitely long time. So delivery of signals at the Python level can be delayed.

LCD Monitor
External Hard Drive
USB Hard Drive
Visa For India
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Linux Query