Unix programmers and Idle

Niklas Norrthon niklas.norrthon at hotmail.com
Tue Mar 31 01:54:56 EDT 2009


On 31 Mar, 01:16, Dale Amon <a... at vnl.com> wrote:
> I wonder if someone could point me at documentation
> on how to debug some of the standard Unix type things
> in Idle. I cannot seem to figure out how to set my
> argument line for the program I am debugging in an Idle
> window. for example:
>
>         vlmdeckcheck.py --strict --debug file.dat
>
> There must be a way to tell it what the command line args
> are for the test run but I can't find it so far.

As others have said it isn't. This is what I do:

I make sure my scripts are on the form:

# imports

# global initialization (not depending on sys.argv)

def main():
    # initialization (might depend on sys.argv)
    # script logic

# other functions

if __name__ == '__main__':
    main()

Then I have a trivial debug script named debug_whatever.py, which I
use as my entry point during debugging:

# debug_whatever.py:
import sys
sys.argv[1:] = ['arg1', 'arg2', 'arg3']

import whatever
whatever.main()

/Niklas Norrthon



More information about the Python-list mailing list