Issue 31413: Support importing anything in ._pth files. (original) (raw)

Issue31413

Created on 2017-09-11 01:19 by Decorater, last changed 2022-04-11 14:58 by admin. 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 .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
2022-04-11 14:58:52 admin set github: 75594
2017-09-11 20:52:05 steve.dower set status: open -> closedtype: crash -> behaviormessages: + resolution: not a bugstage: resolved
2017-09-11 01:36:50 Decorater set type: crash
2017-09-11 01:19:39 Decorater create