classification
Title: Support importing anything in ._pth files.
Type: behavior Stage: resolved
Components: Interpreter Core, Windows Versions: Python 3.7, Python 3.6
process
Status: closed Resolution: not a bug
Dependencies: Superseder:
Assigned To: Nosy List: Decorater, paul.moore, steve.dower, tim.golden, zach.ware
Priority: normal Keywords:

Created on 2017-09-11 01:19 by Decorater, last changed 2017-09-11 20:52 by steve.dower. This issue is now closed.

Messages (2)
msg301846 - (view) Author: Decorater (Decorater) * Date: 2017-09-11 01:19
E:\TinyURL\app\Release>tinyurl
Fatal Python error: only 'import site' is supported in ._pth file

Current thread 0x0000161c (most recent call first):

The above Happens when I try to use the ._pth file to automatically call <something>.main()

However it prints that and then Crashes on Windows. I am not sure about how it does on linux or not.

I would like this extended to work how I thought it would. (To support more than just site.py in the standard library as this would reduce rebuilds of embedded interpreters.
msg301900 - (view) Author: Steve Dower (steve.dower) * (Python committer) Date: 2017-09-11 20:52
This is by design. You should not be using the ._pth file for anything other than initializing sys.path.

If you want to run code at startup, consider using sitecustomize.py or a regular .pth file, all of which will be imported when you include "import site" in the ._pth file.
History
Date User Action Args
2017-09-11 20:52:05steve.dowersetstatus: open -> closed
type: crash -> behavior
messages: + msg301900

resolution: not a bug
stage: resolved
2017-09-11 01:36:50Decoratersettype: crash
2017-09-11 01:19:39Decoratercreate