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


Groups > comp.lang.python > #96880

Re: .bat file trouble.

Path csiph.com!news.mixmin.net!feeds.phibee-telecom.net!newsfeed.xs4all.nl!newsfeed7.news.xs4all.nl!news.tele.dk!news.tele.dk!small.news.tele.dk!newsgate.cistron.nl!newsgate.news.xs4all.nl!nzpost1.xs4all.net!not-for-mail
Return-Path <eryksun@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.004
X-Spam-Evidence '*H*': 0.99; '*S*': 0.00; 'subject:file': 0.07; 'trailing': 0.07; 'variable,': 0.07; 'scripts': 0.09; 'cmd': 0.09; 'files:': 0.09; 'python': 0.10; 'desktop.': 0.16; 'right-click': 0.16; 'wrote:': 0.16; 'directory.': 0.18; 'shell': 0.18; 'runs': 0.18; 'windows': 0.20; 'work,': 0.21; 'file.': 0.22; 'originally': 0.23; 'references': 0.23; 'header:In-Reply-To:1': 0.24; 'message- id:@mail.gmail.com': 0.27; 'environment': 0.29; 'putting': 0.30; 'relative': 0.30; 'another': 0.32; 'getting': 0.33; 'run': 0.33; 'usually': 0.33; 'directory,': 0.33; 'file': 0.34; 'that,': 0.34; 'received:google.com': 0.35; 'could': 0.35; 'i.e.': 0.35; 'path': 0.35; 'but': 0.36; 'should': 0.36; 'there': 0.36; 'to:addr:python- list': 0.36; 'being': 0.37; 'link.': 0.37; 'missing': 0.37; 'thought': 0.37; 'christian': 0.38; 'skip:p 20': 0.38; 'expressed': 0.39; 'to:addr:python.org': 0.40; 'where': 0.40; 'different': 0.63; 'gollwitzer': 0.84
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :content-type; bh=SxDbsFWasIaa7voRCRqPn+5G6us/C0ga0PuD9oUC60U=; b=F4p+1a1lNOa7sCGLpHDPQAcW5TZBvdilju4t4oVdNNuPIulZyXyywJf05E0ecLnIIf PmNqV6wWjxXZHkm2PnG/OuWwjWQgNeudt5TTTXADXxA2VD+J/PM0GiU8r4+A3HTSUBlX ZcsNKGL21HUCSViN6Bjh9WQyd9lVWs9zFmrvSxWPAuMJY4kll7wVldMSTbTDBeplzxtf vc+mY+ZUHnwqDnktB4/DkNM/SbZ9tlTfP1V18itNMeg/ZTW1hNyJFwArlcPLYDTMQ7DX ZqPInugSVcPu6fdXHkXkAPy40QniqiGW8qgojx8XWDchpaz63Br0lmtkYxWfzBDOmbxs yBCA==
X-Received by 10.170.169.66 with SMTP id l63mr12531272ykd.60.1442760832274; Sun, 20 Sep 2015 07:53:52 -0700 (PDT)
MIME-Version 1.0
In-Reply-To <mth4e7$atq$1@dont-email.me>
References <d4e0dfd5-a87e-49a4-9a7c-696aabf527f2@googlegroups.com> <mth4e7$atq$1@dont-email.me>
From eryksun <eryksun@gmail.com>
Date Sun, 20 Sep 2015 09:53:12 -0500
Subject Re: .bat file trouble.
To python-list@python.org
Content-Type text/plain; charset=UTF-8
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.20+
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.40.1442760834.21674.python-list@python.org> (permalink)
Lines 21
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1442760834 news.xs4all.nl 23852 [2001:888:2000:d::a6]:60559
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:96880

Show key headers only | View raw


On 9/18/15, Christian Gollwitzer <auriocus@gmx.de> wrote:
> Am 18.09.15 um 11:06 schrieb bobertini@googlemail.com:
>
>> We originally thought that it was because it was missing the files:
>> process_init.py and process_global_variables.py however they are
>> right there in the same directory.
>
> Concerning that, windows usually runs a .bat file in the directory where
> it is situated, so putting the python fies there /should/ work, but you
> can also set this using the right-click menu (execute in...), if you
> make a link to the desktop.

It's fragile to depend on being started by Explorer or a shell link.
For example, if the batch is run from an existing cmd shell, then it
runs with cmd's current working directory. Or another process could
run the batch file with a different working directory. If you actually
want the batch to find the scripts relative to its own directory, then
it should use the %0 environment variable, which references the
fully-qualified path of the batch file. Getting just the directory,
i.e. its [d]rive and [p]ath, is expressed as %~dp0. Note that this
path includes a trailing backslash.

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


Thread

.bat file trouble. bobertini@googlemail.com - 2015-09-18 02:06 -0700
  Re: .bat file trouble. Steven D'Aprano <steve@pearwood.info> - 2015-09-18 19:32 +1000
  Re: .bat file trouble. Christian Gollwitzer <auriocus@gmx.de> - 2015-09-18 15:45 +0200
    Re: .bat file trouble. eryksun <eryksun@gmail.com> - 2015-09-20 09:53 -0500
    Re: .bat file trouble. Ian Kelly <ian.g.kelly@gmail.com> - 2015-09-20 09:43 -0600

csiph-web