Importing modules through directory shortcuts on Windows

Roger Upole rupole at hotmail.com
Thu Apr 27 03:27:38 EDT 2006


You can use win32file.DeviceIoControl to link directories.
I can post some code to do so if anyone's interested.

       Roger


"Brian Quinlan" <brian at sweetapp.com> wrote in message news:mailman.5014.1146058576.27775.python-list at python.org...
> Recently, I became responsible for maintaining some Python code, which was organized as follows:
>
> user/pylib
>      ui
>      ...
> project2/pylib
>          ui
>          ...
> project3/pylib
>          ui
>          ...
> python-packages/user => /user/pylib
>                 project2 => /project2/pylib
>                 project3 => /project3/pylib
>
> The idea is that "python-packages" is added to sys.path and then every project can import the library package from every other 
> project. NOTE: I think that this structure is crazy but I'm just the poor maintenance programmer.
>
> Anyway, the problem is that Windows does not have a symlink facility to accommodate this (AFAIK) and the Python import 
> mechanism does not resolve shortcuts.
>
> Therefore, I wrote a very simple import hook to get around that problem. If you are interested, the code is here:
> http://www.sweetapp.com/shortcut/shortcutimporter.py
>
> BTW, does anyone else think that this functionality should be part of core Python?
>
> Cheers,
> Brian 




----== Posted via Newsfeeds.Com - Unlimited-Unrestricted-Secure Usenet News==----
http://www.newsfeeds.com The #1 Newsgroup Service in the World! >100,000 Newsgroups
---= East/West-Coast Server Farms - Total Privacy via Encryption =---



More information about the Python-list mailing list