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


Groups > comp.lang.python > #18320

Re: Can't write to a directory made w/ os.makedirs

Path csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!gegeweb.org!de-l.enfer-du-nord.net!feeder1.enfer-du-nord.net!newsfeed.eweka.nl!feeder3.eweka.nl!81.171.88.15.MISMATCH!eweka.nl!lightspeed.eweka.nl!194.134.4.91.MISMATCH!news2.euro.net!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <mail@timgolden.me.uk>
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; 'does.': 0.07; 'override': 0.07; 'script,': 0.07; 'dict': 0.09; 'from:addr:timgolden.me.uk': 0.09; 'from:name:tim golden': 0.09; 'message-id:@timgolden.me.uk': 0.09; 'double-quote': 0.16; 'param': 0.16; 'received:74.55.86': 0.16; 'received:74.55.86.74': 0.16; 'received:smtp.webfaction.com': 0.16; 'received:webfaction.com': 0.16; 'runs,': 0.16; 'this:': 0.16; 'wrote:': 0.18; 'appropriate': 0.22; 'header:In-Reply-To:1': 0.22; "shouldn't": 0.23; 'pass': 0.29; 'second,': 0.30; 'tjg': 0.30; 'least': 0.30; 'app': 0.31; 'version': 0.32; 'certainly': 0.32; 'list': 0.32; 'header:User- Agent:1': 0.33; 'to:addr:python-list': 0.34; 'things': 0.34; 'skip:" 20': 0.35; 'david': 0.36; 'are.': 0.37; 'skip:" 10': 0.37; 'received:192': 0.37; 'using': 0.38; 'received:192.168.0': 0.38; 'either': 0.39; 'should': 0.39; 'to:addr:python.org': 0.40; 'received:192.168': 0.40; 'your': 0.61; 'from:addr:mail': 0.64; 'dict,': 0.84; 'subject:write': 0.84; 'subject:made': 0.93
Date Mon, 02 Jan 2012 11:11:27 +0000
From Tim Golden <mail@timgolden.me.uk>
User-Agent Mozilla/5.0 (Windows NT 6.1; WOW64; rv:9.0) Gecko/20111222 Thunderbird/9.0.1
MIME-Version 1.0
To python-list@python.org
Subject Re: Can't write to a directory made w/ os.makedirs
References <50693cc2-93c9-481d-9fb1-42312e69b2d9@c42g2000prb.googlegroups.com> <mailman.4289.1325410678.27778.python-list@python.org> <91830ffb-00d9-4fd1-b771-ad59374334ec@n22g2000prh.googlegroups.com> <mailman.4292.1325430363.27778.python-list@python.org> <6348b96c-f7a9-4ca6-a704-c90d25f07788@y25g2000prg.googlegroups.com>
In-Reply-To <6348b96c-f7a9-4ca6-a704-c90d25f07788@y25g2000prg.googlegroups.com>
Content-Type text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding 7bit
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.4306.1325502694.27778.python-list@python.org> (permalink)
Lines 35
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1325502694 news.xs4all.nl 6978 [2001:888:2000:d::a6]:50158
X-Complaints-To abuse@xs4all.nl
Xref x330-a1.tempe.blueboxinc.net comp.lang.python:18320

Show key headers only | View raw


On 02/01/2012 03:14, David Goldsmith wrote:
> Here's my script, in case that helps:

It certainly does. A few things occur to me.

First, you
shouldn't need to double-quote the path; the subprocess.call
should do that for you as long as you're using the list
version of the param -- which you are.

Second, you almost certainly don't want to be using the
env param, at least not in the way you are. Depending on
the way in which your app runs, either pass the appropriate
directory as the cwd= param, or copy and override the
current environ dict, ie either do this:

subprocess.call (
   ['c:/program files/somewhere/app.exe', 'blah1', 'blah2'],
   cwd="c:/somewhere/else"
)

or this:

env = dict (os.environ)
env['PATH'] = "c:/somewhere/else"
# or env['PATH'] += ";c:/somewhere/else"
subprocess.call (
   ['c:/program files/somewhere/app.exe', 'blah1', 'blah2'],
   env=env
)


See if any of that helps

TJG

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


Thread

[Windows 7, Python 2.6] Can't write to a directory made w/ os.makedirs OlyDLG <d.l.goldsmith@gmail.com> - 2011-12-31 14:13 -0800
  Re: [Windows 7, Python 2.6] Can't write to a directory made w/ os.makedirs Tim Golden <mail@timgolden.me.uk> - 2012-01-01 09:37 +0000
    Re: Can't write to a directory made w/ os.makedirs David Goldsmith <eulergaussriemann@gmail.com> - 2012-01-01 04:05 -0800
      Re: Can't write to a directory made w/ os.makedirs Tim Golden <mail@timgolden.me.uk> - 2012-01-01 15:05 +0000
        Re: Can't write to a directory made w/ os.makedirs David Goldsmith <eulergaussriemann@gmail.com> - 2012-01-01 19:14 -0800
          Re: Can't write to a directory made w/ os.makedirs MRAB <python@mrabarnett.plus.com> - 2012-01-02 03:43 +0000
            Re: Can't write to a directory made w/ os.makedirs David Goldsmith <eulergaussriemann@gmail.com> - 2012-01-03 07:17 -0800
          Re: Can't write to a directory made w/ os.makedirs Tim Golden <mail@timgolden.me.uk> - 2012-01-02 11:11 +0000
          Re: Can't write to a directory made w/ os.makedirs Dave Angel <d@davea.name> - 2012-01-02 09:09 -0500
            Re: Can't write to a directory made w/ os.makedirs David Goldsmith <eulergaussriemann@gmail.com> - 2012-01-02 18:34 -0800

csiph-web