[Python-ideas] [Python-Dev] If you shadow a module in the standard library that IDLE depends on, bad things happen

MRAB python at mrabarnett.plus.com
Mon Nov 2 20:22:29 EST 2015


On 2015-11-03 00:02, Greg Ewing wrote:
> Terry Reedy wrote:
>> '' is not very informative ;-).
>> I suspect the full path added in the past, but it is not now.
>> import os; os.getcwd() works better
>
> You misunderstand. The point is *not* to find the
> cwd, it's to find the directory containing the main
> script, so you can load resources related to it.
>
> There are probably other and possibly better ways
> to go about that, but it works and is sometimes
> used. The proposed change would break it.
>
I use os.path.dirname(__file__) in the main script.



More information about the Python-ideas mailing list