Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #15392
| Path | csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!news.albasani.net!feeder.erje.net!newsfeed.xs4all.nl!newsfeed5.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail |
|---|---|
| Return-Path | <cameron@cskk.homeip.net> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.000 |
| X-Spam-Evidence | '*H*': 1.00; '*S*': 0.00; 'python,': 0.01; 'subject:Python': 0.06; 'exception,': 0.07; 'forth.': 0.07; 'received:edu.au': 0.07; 'python': 0.08; 'foo': 0.09; 'linux.': 0.09; 'broken': 0.12; 'debugging': 0.13; 'argument': 0.15; 'cc:addr:python-list': 0.15; 'changing:': 0.16; 'collects': 0.16; 'finder': 0.16; 'from:addr:cs': 0.16; 'from:addr:zip.com.au': 0.16; 'from:name:cameron simpson': 0.16; 'gene': 0.16; 'is",': 0.16; 'logic.': 0.16; 'message-id:@cskk.homeip.net': 0.16; 'received:202.125.174': 0.16; 'received:202.125.174.133': 0.16; 'received:boardofstudies.nsw.edu.au': 0.16; 'received:cskk.homeip.net': 0.16; 'received:harvey.boardofstudies.nsw.edu.au': 0.16; 'received:homeip.net': 0.16; 'received:nsw.edu.au': 0.16; 'linux': 0.17; 'cheers,': 0.18; 'wrote:': 0.18; 'driver': 0.18; 'trying': 0.21; 'cc:no real name:2**0': 0.21; 'subject:please': 0.21; 'runs': 0.23; 'indentation': 0.23; 'header:In-Reply-To:1': 0.23; 'command': 0.24; 'suspect': 0.24; 'cc:2**0': 0.25; '"the': 0.26; 'raise': 0.27; 'script': 0.28; 'fixed': 0.28; 'looks': 0.28; 'cc:addr:python.org': 0.29; 'print': 0.29; "i'll": 0.31; 'least': 0.31; 'value.': 0.32; 'usually': 0.32; "isn't": 0.32; 'there': 0.33; 'header:User-Agent:1': 0.33; 'test': 0.34; 'null': 0.34; '(for': 0.35; 'received:au': 0.36; 'charset:us-ascii': 0.36; 'but': 0.37; 'run': 0.38; 'some': 0.38; 'perhaps': 0.38; 'enough': 0.38; 'subject:: ': 0.39; 'more': 0.60; 'link': 0.63; 'our': 0.63; 'received:202': 0.65; 'here:': 0.66; 'instantly': 0.67; 'day': 0.67; 'flow': 0.71; 'cameron': 0.73; 'greetings': 0.74; 'error- free.': 0.84; 'me:': 0.84; 'nss': 0.84; 'roads': 0.91 |
| Date | Mon, 7 Nov 2011 07:34:29 +1100 |
| From | Cameron Simpson <cs@zip.com.au> |
| To | gene heskett <gheskett@wdtv.com> |
| Subject | Re: Python lesson please |
| MIME-Version | 1.0 |
| Content-Type | text/plain; charset=us-ascii |
| Content-Disposition | inline |
| In-Reply-To | <201111061314.43744.gheskett@wdtv.com> |
| User-Agent | Mutt/1.5.21 (2010-09-15) |
| References | <201111061314.43744.gheskett@wdtv.com> |
| Cc | python-list@python.org |
| X-BeenThere | python-list@python.org |
| X-Mailman-Version | 2.1.12 |
| Precedence | list |
| List-Id | General discussion list for the Python programming language <python-list.python.org> |
| List-Unsubscribe | <http://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe> |
| List-Archive | <http://mail.python.org/pipermail/python-list> |
| List-Post | <mailto:python-list@python.org> |
| List-Help | <mailto:python-list-request@python.org?subject=help> |
| List-Subscribe | <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.2475.1320612267.27778.python-list@python.org> (permalink) |
| Lines | 66 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1320612267 news.xs4all.nl 6889 [2001:888:2000:d::a6]:42851 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | x330-a1.tempe.blueboxinc.net comp.lang.python:15392 |
Show key headers only | View raw
On 06Nov2011 13:14, gene heskett <gheskett@wdtv.com> 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.
That line collects the first command line argument. sys.argv is the
command line; argv[0] is the command name, argv[1] the first argument
and so forth.
Also, if there is no first argument then trying to access argv[1] will
raise an IndexError exception, not return a null value.
If you're this new to python, note that easy debugging statements can be
written:
print >>sys.stderr, "the value of foo is", foo
and so forth.
Perhaps more relevantly:
If you have unmangled a lot of tabs, remember that control flow is
indentation based in python, and you may have broken some logic.
(For this reason a number of us set our editors to work only in spaces).
Anyway, while changing:
statement1
statement2
into:
statement1
statement2
will usually make python complain, changing:
if some test here:
statement1
statement2
into:
if some test here:
statement1
statement2
just means that statement2 is no longer inside the if-statement, and
elicit no compaints. But will elicit bugs!
Cheers,
--
Cameron Simpson <cs@zip.com.au> DoD#743
http://www.cskk.ezoshosting.com/cs/
The ZZR-1100 is not the bike for me, but the day they invent "nerf" roads
and ban radars I'll be the first in line......AMCN
Back to comp.lang.python | Previous | Next | Find similar | Unroll thread
Re: Python lesson please Cameron Simpson <cs@zip.com.au> - 2011-11-07 07:34 +1100
csiph-web