In the following structure:
- foobar
- __init__.py
- pyfoo
- __init__.py
- foo.pyd
- src
- __init__.py
- test
- __init__.py
- bar.py
I try to load foo.pyd from bar.py.
Therefor I inserted an entry into PYTHONPATH with \\?\C:\<path_to_foobar>\foobar\pyfoo.
In bar.py I then try to
import foo
, which never finds foo.
Now when I look at sys.path, entries from PYTHONPATH are missing.
Also, when I look under which paths foo.pyd is searched, only paths of sys.path are taken into account.
So how come sys.path does not contain all paths of PYTHONPATH?
EDIT:
To test the paths I inserted logs right before import:
print("SP %s" % sys.path)
print("PP %s" % os.environ["PYTHONPATH"])
Which gives me something like:
SP ['\\\\?\\B:\\foobar\\pyfoo\\src\\test', 'C:\\python3\\win_x86_64\\python35.zip', 'C:\\python3\\win_x86_64\\DLLs', 'C:\\python3\\win_x86_64\\lib', 'C:\\python3\\win_x86_64']
PP \\?\B:\;\\?\B:\foobar\pyfoo;\\?\B:\foobar;\\?\B:\foobar\pyfoo
?. If not there's a first problem: this cannot be a valid path. And the other error is the drive:which should be$in the case of UNC paths with drives. Your UNC paths doesn't seem valid.