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


Groups > comp.lang.python > #15385 > unrolled thread

Python lesson please

Started bygene heskett <gheskett@wdtv.com>
First post2011-11-06 13:14 -0500
Last post2011-11-07 02:54 +0000
Articles 2 — 2 participants

Back to article view | Back to comp.lang.python


Contents

  Python lesson please gene heskett <gheskett@wdtv.com> - 2011-11-06 13:14 -0500
    Re: Python lesson please Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2011-11-07 02:54 +0000

#15385 — Python lesson please

Fromgene heskett <gheskett@wdtv.com>
Date2011-11-06 13:14 -0500
SubjectPython lesson please
Message-ID<mailman.2468.1320603689.27778.python-list@python.org>
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
-- 
"There are four boxes to be used in defense of liberty:
 soap, ballot, jury, and ammo. Please use in that order."
-Ed Howdershelt (Author)
My web page: <http://coyoteden.dyndns-free.com:85/gene>
Most of the fear that spoils our life comes from attacking difficulties
before we get to them.
		-- Dr. Frank Crane

[toc] | [next] | [standalone]


#15397

FromSteven D'Aprano <steve+comp.lang.python@pearwood.info>
Date2011-11-07 02:54 +0000
Message-ID<4eb74858$0$29988$c3e8da3$5496439d@news.astraweb.com>
In reply to#15385
On Sun, 06 Nov 2011 13:14:43 -0500, gene heskett wrote:

> 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.

<raises eyebrow>

Presumably the script should be working. If it is known to be not 
working, then you probably need to fix a lot more than just indentation.

If this is "pre-alpha, doesn't even compile" software, then good luck, 
you'll need to read the source and understand it to make it work. It's 
not sufficient to just get it to a point where you can say "Cool, it 
compiles!" by fixing some indentation.

If this is supposed to be working, there's a reason why it's not working 
for you. Perhaps you are trying to use it with the wrong version of 
Python. Perhaps the download is corrupted. Fix those before mangling 
indentation in random ways: start with a fresh, uncorrupted download. 
Check that the md5 sum matches that provided by the download site 
(assuming they provide one). Find out what version of Python is 
supported, and use that.


> This line looks suspect to me:
>  rootdir = sys.argv[1]

What makes you think that line is suspect? It looks fine to me.


> And I have a suspicion it is null on a linux box.

This is Python, not bash. Sys arguments are not filled in with "null", 
whatever you think "null" is. (The None built-in? The empty string?)

Have you tried giving the script an argument when you call it? If in 
doubt, call it with "." (the current directory) as argument.

My wild guess is that you actually need to supply a meaningful directory 
path before the script will do anything, and until then, it will silently 
fail. Which is terrible design.


> How can I fix that best?

If it's not broken, it doesn't need to be fixed. Don't make assumptions 
about what code needs to be fixed based on nothing more than gut feeling.



-- 
Steven

[toc] | [prev] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web