Python has to import the module in order to access parts of it.

If you access sys.argv as part of the module definition you're going to
have these issues. If you can't or won't put it in a repo here's the best
help is at this pastebin (will expire on Friday ~ noon PDT)

http://pastebin.com/LLgtCYA2


On Thu, Aug 1, 2013 at 12:00 PM, <[email protected]>wrote:

> Send seattle-python mailing list submissions to
>         [email protected]
>
> To subscribe or unsubscribe via the World Wide Web, visit
>         http://lists.seapig.org/mailman/listinfo/seattle-python
> or, via email, send a message with subject or body 'help' to
>         [email protected]
>
> You can reach the person managing the list at
>         [email protected]
>
> When replying, please edit your Subject line so it is more specific
> than "Re: Contents of seattle-python digest..."
>
>
> Today's Topics:
>
>    1.  help(<myModule>) raising index out of range exception
>       (David Goldsmith)
>
>
> ----------------------------------------------------------------------
>
> Message: 1
> Date: Thu, 1 Aug 2013 11:58:16 -0700
> From: David Goldsmith <[email protected]>
> To: Seattle Python Interest Group <[email protected]>
> Subject: [SEAPY] help(<myModule>) raising index out of range exception
> Message-ID:
>         <CAFtPsZptv1pJ_kxVhEC+a=
> [email protected]>
> Content-Type: text/plain; charset="iso-8859-1"
>
> 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
> -------------- next part --------------
> An HTML attachment was scrubbed...
> URL: <
> http://lists.seapig.org/pipermail/seattle-python/attachments/20130801/daf38d6b/attachment-0001.html
> >
>
> End of seattle-python Digest, Vol 112, Issue 1
> **********************************************
>

Reply via email to