[Python-Dev] how to find the file path to an extension module at init time? (original) (raw)

"Martin v. Löwis" martin at v.loewis.de
Sun Nov 13 21:46:31 CET 2011


I'm asking specifically because I'd like to properly implement file in Cython modules at module init time.

Why do you need to implement file? Python will set it eventually to its correct value, no?

Another problem is that package local imports from init.py no longer work when it's compiled

Does it actually work to have init be an extension module?

Any ideas how this could currently be achieved?

Currently, for Cython? I don't think that can work.

Or could this become a new feature in the future?

Certainly. An approach similar to _Py_PackageContext should be possible.

Regards, Martin



More information about the Python-Dev mailing list