Hey David,

It might be helpful if you could post a repro. case on a pastebin or
something. Also, what happens if you take your code, wrap it in a trivial
function, and then at the bottom, call the function as follows:
    if __name__ == '__main__':
        foo()
As far as I know, that's the more idiomatic way of making command-line
scripts in Python.

Thanks,
Rohit Patnaik


On Thu, Aug 1, 2013 at 11:58 AM, David Goldsmith <[email protected]>wrote:

> Hi, folks.  First off, I've done "due diligence" searching the Python Refs
> and Google, to no avail.  I seem to have forgotten something fundamental
> about using help with module-level docstrings: help('myModule') is raising
> an "index out of range" exception.  myModule.py is an argument-requiring
> "script" (i.e., no "top level" def) that begins with a triple-quoted,
> multi-line docstring.  The only "clue" I have is that if I first try to
> import the module, I get a  "myVariable = sys.argv[1] IndexError: list
> index out of range" exception, which is no surprise since, as I said, the
> module requires at least one command line argument.  Does help try to
> import an object before attempting to spew its docstring?  If so, is there
> a "workaround" for my use-case as it stands, or do I have to "fix" my
> script so that all arguments are optional?  If that's not the problem, any
> other ideas what it might be?  Thanks in advance!
>
> OlyDLG
>
>

Reply via email to