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


Groups > comp.lang.python > #74095

Re: How do you use `help` when write your code

References (3 earlier) <roy-CE5D08.15151006072014@news.panix.com> <mailman.11564.1404687291.18130.python-list@python.org> <roy-4B7140.20523306072014@news.panix.com> <mailman.11570.1404702375.18130.python-list@python.org> <roy-17D234.07221507072014@news.panix.com>
Date 2014-07-07 21:36 +1000
Subject Re: How do you use `help` when write your code
From Chris Angelico <rosuav@gmail.com>
Newsgroups comp.lang.python
Message-ID <mailman.11584.1404732978.18130.python-list@python.org> (permalink)

Show all headers | View raw


On Mon, Jul 7, 2014 at 9:22 PM, Roy Smith <roy@panix.com> wrote:
> In article <mailman.11570.1404702375.18130.python-list@python.org>,
>  Chris Angelico <rosuav@gmail.com> wrote:
>
>> That's about it, yeah. I tend to find both strace and tcpdump rather
>> too spammy for most usage, so any time I reach for those tools, it's
>> usually with some tight filtering - and even that's not always
>> helpful.
>
> Usually, when I fire up strace, it's because I'm looking for something
> specific.  A common use case is, "I just edited this config file, but it
> doesn't seem to be having any effect".  I'll do something like "strace
> -e file" and grep out all the open() calls.  From there, it's trivial to
> verify that it is indeed reading my config file (or not).  Or that
> there's other config files (/usr/share/whatever) that it's reading that
> I didn't even know existed, which might be overriding my own.  Likewise
> for which libraries it's linking against, which executables it's
> running, etc.

Yep. Sometimes it's fairly easy. I was trying to figure out where
rdesktop was looking for its keymaps, and rather than hunt down the
source, I just straced it and watched for errors, and found that it
was looking for ~/.rdesktop/keymaps, so I made that as a symlink to
what I wanted. (I'm sure I could have found this somewhere in the
docs, but after a small amount of searching, I didn't have any
indication of where; and for this job, I needed it to be local, rather
than in a root-owned directory.) That one was pretty straight-forward.
The time I was trying to trace that game, though, I was trying to
figure out why it was unable to save screenshots; and since the most
likely cause was an incorrect path name, I couldn't search for the
path. Had to negate the search - run the trace, then filter out
everything that looks like the one most common line, rinse and repeat
until it's silent. Then hit the screenshot key. Whoops, filtered out
too much, didn't see a thing.... weaken the filters, start again.
Would have liked source code for THAT one! A simple line of "write my
parameters to stderr" would have done the job.

At the end of the day, it's just another tool in the box. You learn to
use it because there are times when it's the right one for the job.

ChrisA

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


Thread

How do you use `help` when write your code Shiyao Ma <i@introo.me> - 2014-07-07 00:36 +0800
  Re: How do you use `help` when write your code Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2014-07-06 17:52 +0000
    Re: How do you use `help` when write your code Tim Chase <python.list@tim.thechases.com> - 2014-07-06 13:22 -0500
    Re: How do you use `help` when write your code Roy Smith <roy@panix.com> - 2014-07-06 14:48 -0400
  Re: How do you use `help` when write your code Rick Johnson <rantingrickjohnson@gmail.com> - 2014-07-06 11:48 -0700
    Re: How do you use `help` when write your code Mark Lawrence <breamoreboy@yahoo.co.uk> - 2014-07-06 19:58 +0100
      Re: How do you use `help` when write your code Roy Smith <roy@panix.com> - 2014-07-06 15:15 -0400
        Re: How do you use `help` when write your code Chris Angelico <rosuav@gmail.com> - 2014-07-07 08:54 +1000
          Re: How do you use `help` when write your code Roy Smith <roy@panix.com> - 2014-07-06 20:52 -0400
            Re: How do you use `help` when write your code Chris Angelico <rosuav@gmail.com> - 2014-07-07 13:06 +1000
              Re: How do you use `help` when write your code Roy Smith <roy@panix.com> - 2014-07-07 07:22 -0400
                Re: How do you use `help` when write your code Chris Angelico <rosuav@gmail.com> - 2014-07-07 21:36 +1000
        Re: How do you use `help` when write your code Cameron Simpson <cs@zip.com.au> - 2014-07-07 11:51 +1000

csiph-web