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


Groups > comp.lang.python > #57834

Re: Function for the path of the script?

Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!news.stack.nl!newsfeed.xs4all.nl!newsfeed2.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail
Return-Path <rosuav@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.017
X-Spam-Evidence '*H*': 0.97; '*S*': 0.00; 'scripts': 0.03; 'sanity': 0.09; 'subject:Function': 0.09; 'subject:script': 0.09; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'locating': 0.16; 'path.': 0.16; 'files.': 0.16; 'wrote:': 0.18; 'directory.': 0.24; 'source': 0.25; 'gets': 0.27; 'header:In- Reply-To:1': 0.27; 'installed': 0.27; 'point': 0.28; 'chris': 0.29; 'am,': 0.29; 'unix': 0.29; 'message-id:@mail.gmail.com': 0.30; 'usually': 0.31; 'run': 0.32; 'subject:the': 0.34; 'common': 0.35; 'but': 0.35; 'received:google.com': 0.35; 'belong': 0.36; 'view,': 0.36; 'done': 0.36; 'subject:?': 0.36; 'easiest': 0.38; 'to:addr:python-list': 0.38; 'files': 0.38; 'to:addr:python.org': 0.39; "you're": 0.61; 'programs,': 0.74; 'edwards': 0.91; '2013': 0.98
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; bh=dW6CUs+ukAlaWiE2pPg7cOuZo0eaY7ZJwXblHS+5ANQ=; b=ctLC2GzyVbdDJXR0CNWL7b4vYl/4q0SgPxVvV5Q5LHHPP1IZveiJMmoIJiMHpAevXa W7uTbUQJZfQaw2E8UBmdftRxaBBurvm6xrvoZ8a3o15lo9mN8UXZ3My4Yky0GwaXnIkx 3wjXcAs99cQsvUQPpiYo0efC+Eeu3uM5CcSuQoNdZ6JjjjcUIL+wYDz8HJca47PlQhF6 0M+4Z1qcs9kxz1Jz+5Xn8w52of+kO63inPsUc1Kax8E9UsT2z5TV2R61Uz/cafeh0RBv vZusXLk3DZghhzgZJHrBFmV9D78ejHFKICi89e7ZmdNEpQIMT/+bwxkpWhHE3Hy0MSvz 8vNA==
MIME-Version 1.0
X-Received by 10.66.163.2 with SMTP id ye2mr2336732pab.170.1382972386420; Mon, 28 Oct 2013 07:59:46 -0700 (PDT)
In-Reply-To <l4ltik$9oc$5@reader1.panix.com>
References <00704f33-7e7f-4ccf-b28b-69776d2e237d@googlegroups.com> <526C7FEF.7020206@islandtraining.com> <mailman.1635.1382842917.18130.python-list@python.org> <l4ltik$9oc$5@reader1.panix.com>
Date Tue, 29 Oct 2013 01:59:46 +1100
Subject Re: Function for the path of the script?
From Chris Angelico <rosuav@gmail.com>
To python-list@python.org
Content-Type text/plain; charset=ISO-8859-1
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.15
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <https://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 <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.1705.1382972391.18130.python-list@python.org> (permalink)
Lines 15
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1382972391 news.xs4all.nl 15931 [2001:888:2000:d::a6]:37755
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:57834

Show key headers only | View raw


On Tue, Oct 29, 2013 at 1:49 AM, Grant Edwards <invalid@invalid.invalid> wrote:
> On 2013-10-27, Chris Angelico <rosuav@gmail.com> wrote:
>> It's very common to want to know what directory you're in - it's a
>> good way to find data files.
>
> From a Unix point of view, that's also very wrong.  Data files don't
> belong in the same directory as the executable.

For installed programs, maybe; but we run a lot of scripts out of
source control, like a sanity checker that gets run immediately before
a commit. Some of them need data files that are also source-managed,
so we have them in the same directory. Locating those files is usually
easiest done by tailing onto the script's path.

ChrisA

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


Thread

Function for the path of the script? Peter Cacioppi <peter.cacioppi@gmail.com> - 2013-10-26 19:23 -0700
  Re: Function for the path of the script? Skip Montanaro <skip.montanaro@gmail.com> - 2013-10-26 21:42 -0500
  Re: Function for the path of the script? Gary Herron <gary.herron@islandtraining.com> - 2013-10-26 19:52 -0700
  Re: Function for the path of the script? Chris Angelico <rosuav@gmail.com> - 2013-10-27 14:01 +1100
    Re: Function for the path of the script? Grant Edwards <invalid@invalid.invalid> - 2013-10-28 14:49 +0000
      Re: Function for the path of the script? Chris Angelico <rosuav@gmail.com> - 2013-10-29 01:59 +1100
      Re: Function for the path of the script? rurpy@yahoo.com - 2013-10-28 21:00 -0700
        Re: Function for the path of the script? Steven D'Aprano <steve@pearwood.info> - 2013-10-29 05:27 +0000
          Re: Function for the path of the script? Grant Edwards <invalid@invalid.invalid> - 2013-10-29 14:31 +0000
  Re: Function for the path of the script? Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2013-10-27 03:42 +0000
  Re: Function for the path of the script? Ben Finney <ben+python@benfinney.id.au> - 2013-10-27 15:10 +1100
    Re: Function for the path of the script? Roy Smith <roy@panix.com> - 2013-10-27 09:38 -0400
    Re: Function for the path of the script? Grant Edwards <invalid@invalid.invalid> - 2013-10-28 14:58 +0000
      Re: Function for the path of the script? Ben Finney <ben+python@benfinney.id.au> - 2013-10-29 09:50 +1100
        Re: Function for the path of the script? Grant Edwards <invalid@invalid.invalid> - 2013-10-29 14:26 +0000
  How to find where data files are installed for my Python program (was: Function for the path of the script?) Ben Finney <ben+python@benfinney.id.au> - 2013-10-27 15:28 +1100
    Re: How to find where data files are installed for my Python program (was: Function for the path of the script?) rurpy@yahoo.com - 2013-10-26 22:18 -0700
    Re: How to find where data files are installed for my Python program Gregory Ewing <greg.ewing@canterbury.ac.nz> - 2013-10-27 20:58 +1300
      Re: How to find where data files are installed for my Python program Ian Kelly <ian.g.kelly@gmail.com> - 2013-10-27 09:50 -0600
      Re: How to find where data files are installed for my Python program Ben Finney <ben+python@benfinney.id.au> - 2013-10-28 10:13 +1100
      Re: How to find where data files are installed for my Python program Ben Finney <ben+python@benfinney.id.au> - 2013-10-28 10:31 +1100
      Re: How to find where data files are installed for my Python program Chris Angelico <rosuav@gmail.com> - 2013-10-28 10:58 +1100
      Re: How to find where data files are installed for my Python program Mark Lawrence <breamoreboy@yahoo.co.uk> - 2013-10-28 00:34 +0000
      Re: How to find where data files are installed for my Python program Chris Angelico <rosuav@gmail.com> - 2013-10-28 17:51 +1100
        Re: How to find where data files are installed for my Python program Roy Smith <roy@panix.com> - 2013-10-28 08:51 -0400
          Re: How to find where data files are installed for my Python program Chris Angelico <rosuav@gmail.com> - 2013-10-29 00:06 +1100
  Re: How to find where data files are installed for my Python program (was: Function for the path of the script?) Chris Angelico <rosuav@gmail.com> - 2013-10-27 16:49 +1100
  Re: Function for the path of the script? Peter Cacioppi <peter.cacioppi@gmail.com> - 2013-10-28 15:57 -0700
  Re: Function for the path of the script? Peter Cacioppi <peter.cacioppi@gmail.com> - 2013-10-28 22:56 -0700

csiph-web