check if running under IDLE

Bob Gailer bgailer at
Wed Aug 6 18:31:27 CEST 2003

At 11:48 AM 8/6/2003 +0200, Helmut Jarausch wrote:
To check a script accessing sys.argv I have to set it.
>Unfortunately the 'Run' pulldown menu of IDLE doesn't have an item
>to set sys.argv as it's common with debuggers for C.
>Now in Python I can set  sys.argv within the script,
>but forgetting to comment this out afterwards makes the
>script wrong outside of IDLE
>So I'd like to say
>   sys.argv=['test','-a','/home/jarausch/BackUp']
>but I haven't work how to check if the script is running under IDLE's 

import sys
__IDLE_IS_RUNNUNG__ = len(sys.modules) > 20

Bob Gailer
bgailer at
303 442 2625
-------------- next part --------------

Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (
Version: 6.0.506 / Virus Database: 303 - Release Date: 8/1/2003

More information about the Python-list mailing list