Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Linux Query

 
Gracey Smith
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Tim Holloway
Saloon Keeper
Posts: 18303
56
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Alisha Smith
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic