executing python scripts that are symlinked

Dave Angel davea at davea.name
Thu May 16 04:18:05 EDT 2013


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



More information about the Python-list mailing list