[Python-Dev] BDFL-Delegate appointments for several PEPs
Nick Coghlan
ncoghlan at gmail.com
Sat Mar 30 11:26:49 EDT 2019
More information about the Python-Dev mailing list
Sat Mar 30 11:26:49 EDT 2019
- Previous message (by thread): [Python-Dev] BDFL-Delegate appointments for several PEPs
- Next message (by thread): [Python-Dev] BDFL-Delegate appointments for several PEPs
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On Mon, 25 Mar 2019 at 20:34, Cameron Simpson <cs at cskk.id.au> wrote: > Clearly the above needs to accomodate this, possibly with a fallback > guess. Is sniffing the end components of __file__ at all sane? ending in > idlelib/pyshell.py or pyshell.py? Or is that just getting baroque? > > I don't think these are strictly the same from some kind of purist > viewpoint: the path might be anything - _is_ it reasonable to suppose > that it has a module name (== importable/finding through the import > path)? Directly executing files from inside Python packages is explicitly unsupported, and nigh guaranteed to result in a broken import setup, as relative imports won't work, and absolute imports will most likely result in a second copy of the script module getting loaded. The problem is that __main__ always thinks it is a top-level module for directly executed scripts - it needs the package structure information from the "-m" switch to learn otherwise. Cheers, Nick. -- Nick Coghlan | ncoghlan at gmail.com | Brisbane, Australia
- Previous message (by thread): [Python-Dev] BDFL-Delegate appointments for several PEPs
- Next message (by thread): [Python-Dev] BDFL-Delegate appointments for several PEPs
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-Dev mailing list