Path: csiph.com!usenet.pasdenom.info!news.albasani.net!newsfeed.freenet.ag!news2.euro.net!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.005 X-Spam-Evidence: '*H*': 0.99; '*S*': 0.00; 'say,': 0.05; 'string': 0.09; 'executable': 0.09; 'imply': 0.09; 'python': 0.11; 'windows': 0.15; 'charles': 0.16; 'cmd': 0.16; 'cwd': 0.16; 'somehow,': 0.16; 'symlink': 0.16; 'subject:python': 0.16; 'wrote:': 0.18; 'typing': 0.19; 'version.': 0.19; 'examples': 0.20; 'example': 0.22; 'shell': 0.22; 'header:User-Agent:1': 0.23; 'specify': 0.24; 'fine': 0.24; 'environment': 0.24; 'script': 0.25; 'gets': 0.27; 'header:In-Reply-To:1': 0.27; 'am,': 0.29; "doesn't": 0.30; 'absolute': 0.30; 'is?': 0.30; 'that.': 0.31; 'usually': 0.31; 'operations.': 0.31; 'subject:that': 0.31; 'file': 0.32; 'guess': 0.33; 'but': 0.35; 'really': 0.36; 'should': 0.36; 'changing': 0.37; 'system,': 0.38; 'to:addr :python-list': 0.38; 'to:addr:python.org': 0.39; 'how': 0.40; "you're": 0.61; 'real': 0.63; 'line,': 0.68; 'received:74.208': 0.68; 'smith': 0.68; 'received:74.208.4.194': 0.84 Date: Thu, 16 May 2013 04:18:05 -0400 From: Dave Angel User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130329 Thunderbird/17.0.5 MIME-Version: 1.0 To: python-list@python.org Subject: Re: executing python scripts that are symlinked References: <95bc1155-0a83-4ab1-8b76-68a819b2e29a@en2g2000vbb.googlegroups.com> In-Reply-To: <95bc1155-0a83-4ab1-8b76-68a819b2e29a@en2g2000vbb.googlegroups.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Provags-ID: V02:K0:ynoA0UwYafZVCRD2riwiTQQHRfsLieYb+riAWt6wVjM KSeWM5600/Vo3D+NXwHVjcOUXGWbPV6L7Bgje+3caFTlRkKPvO KbFuibA1oaA5fH2GxE2fjmPx5TUJ9bqQY+0z80qSTN8on7jowJ h4aoT/E8s4bWMNS77ogj06NSkl7Qjugg/MOmTsnj396oDhLimx FmqHFAkAUoGYH8HJdI8UP7itPgkKLX3Gd1/ia0KzKk2/Rp2iAh TYY4CXthTSLf59bzYI46lgtQDSzqUob3sQwTYDeDhHQq9JKVV7 4jBZGfPY+NQSSgd/GWTxUnnMzfen1TA49R6FIjZOgQumYminA= = X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 30 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1368692298 news.xs4all.nl 15926 [2001:888:2000:d::a6]:35546 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:45413 On 05/16/2013 03:48 AM, Charles Smith wrote: > Hi. > > How can I say, from the cmd line, that python should take my CWD as my > CWD, and not the directory where the script actually is? > > > I have a python script that works fine when it sits in directory WC, > but if I move it out of WC to H and put a symlink from H/script to WC, > it doesn't find the packages that are in WC. Also, if I use the > absolute path to H, it won't find them, but I guess I can understand > that. > > Someone said on the net that python doesn't know whether a file is > real or a symlink, but I think that somehow, python is able to find > out where the real file is and treat that as its base of operations. > You'd really better specify your environment - exact OS and Python version. symlink and cwd usually imply a Unix-type system, but cmd is a Windows thing. Then give examples of what your cwd is, what string you're typing at the shell prompt, and what's happening. For example windows is good at changing cwd long before the executable gets control, in some situations. -- DaveA