Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #15389

Re: Python lesson please

Date 2011-11-06 15:21 -0500
From Dave Angel <d@davea.name>
Subject Re: Python lesson please
References <201111061314.43744.gheskett@wdtv.com>
Newsgroups comp.lang.python
Message-ID <mailman.2473.1320610922.27778.python-list@python.org> (permalink)

Show all headers | View raw


On 11/06/2011 01:14 PM, gene heskett wrote:
> Greetings experts:
>
> I just dl'd the duqu driver finder script from a link to NSS on /., and
> fixed enough of the tabs in it to make it run error-free.  At least python
> isn't having a litter of cows over the indentation now.
>
> But it also runs instantly on linux.
>
> This line looks suspect to me:
>   rootdir = sys.argv[1]
>
> And I have a suspicion it is null on a linux box.
>
> How can I fix that best?
>
> Thanks.
>
> Cheers, Gene

Nothing wrong with that line, assuming the user of the script happened 
to provide an argument for rootpath.  Probably it should be preceded by 
a a conditional:

     if len(argv) <2:
            tell.user.that.she's.missing.the.rootdir.parameter
      else:
            rootdir = sys.argv[1]
            etc.

What does the help text show when you run the script with the --help 
argument?

-- 

DaveA

Back to comp.lang.python | Previous | Next | Find similar | Unroll thread


Thread

Re: Python lesson please Dave Angel <d@davea.name> - 2011-11-06 15:21 -0500

csiph-web