Skip to content Skip to sidebar Skip to footer

Can You Import A Python Module From A Windows Symbolic Link?

I'm contributing to a Python 3 project from a Windows 7 computer. In order to minimise clutter while making and testing changes, I'm placing a few test files inside a folder called

Solution 1:

I have just spent +2 hours trying to resolve this issue and it turned out that creating a Windows Directory Junction worked for me.

You don't need to use a relative one, it worked with both.

So first create an empty file __init__.py in your igonore-folder then in the elevated mode (As Administrator) create a link:

mklink /J ignore path-to-your-ignore-module

Then in your Python code you would be able to execute: from ignore.something import some-other-thing

Post a Comment for "Can You Import A Python Module From A Windows Symbolic Link?"