NT4 shortcuts and import

Roger Upole rupole at compaq.net
Fri Jul 14 23:27:50 EDT 2000


Python is correct, as usual.  The filename is actually src.lnk.
NT normally hides the extension for shortcut files, but it is
there.
Python will not import automatically thru a shortcut.
You could do it yourself by getting the pathname from
the link and using execfile or something similar, but that
would be a major pain.
Creating a package sounds like what you want to do,
see
http://www.python.org/doc/current/tut/node8.html#SECTION00840000000000000000
0

     HTH
       Roger Upole


"Andy Freeman" <anamax at earthlink.net> wrote in message
news:8koe6q$avh$1 at nnrp1.deja.com...
> I'd like to use a shortcut named, say, "src", from the current
> directory to a directory somewhere else and then use "import src.foo".
> The problem is that NT4 thinks that the shortcut is named "src"
> but Python thinks that the shortcut is named "src.lnk".  Note that
> I can't use "import src.lnk.foo" because the first "." is interpreted
> as a directory name separator, not a part of the "src.lnk" module
> name.
>
> (1) How do I get Python to use "src" as the module name?
> (2) How do I escape "." in variable names?
>
> I'm using Python 1.5.
>
> thanks,
> -andy
>
>
> Sent via Deja.com http://www.deja.com/
> Before you buy.





More information about the Python-list mailing list