So the "current working directory" is the directory containing the file, right? That would explain the behavior.
Probably "Edit with IDLE" should be changed. I have no idea where that is defined. In 3.11 we should be able to make that use the new -P option, which doesn't insert the working directory at the front of sys.path. On Fri, May 13, 2022 at 6:50 PM <ward.dav...@gmail.com> wrote: > Hello, > Link to the github issue page is here > https://github.com/python/cpython/issues/92359 > > This bug has been lurking in waiting for roughly 7 years or possibly > longer. The root issue is that the "Edit with IDLE" context menu executes > idle with `python.exe -m idlelib` which puts the current working directory > in sys.path but inside idlelib it has a `from code import ...` statement. > A kind of ugly hack is sitting in my fork of cpython here > https://github.com/devdave/cpython/blob/issue_92359/Lib/idlelib/__main__.py > . All I did was put the Lib directory at the front of sys.path. > Perhaps this is the best solution? I don't know. > > Would appreciate any ideas for an alternative fix (ex perhaps changing > how "Edit with IDLE" works?) or like I said, perhaps my fix is the best > option because of how simple it is? > > Thanks, > DevDave > _______________________________________________ > Python-Dev mailing list -- python-dev@python.org > To unsubscribe send an email to python-dev-le...@python.org > https://mail.python.org/mailman3/lists/python-dev.python.org/ > Message archived at > https://mail.python.org/archives/list/python-dev@python.org/message/NKMXPIQPISOPOV6OGASKXV4DEDZUH355/ > Code of Conduct: http://python.org/psf/codeofconduct/ > -- --Guido van Rossum (python.org/~guido) *Pronouns: he/him **(why is my pronoun here?)* <http://feministing.com/2015/02/03/how-using-they-as-a-singular-pronoun-can-change-the-world/>
_______________________________________________ Python-Dev mailing list -- python-dev@python.org To unsubscribe send an email to python-dev-le...@python.org https://mail.python.org/mailman3/lists/python-dev.python.org/ Message archived at https://mail.python.org/archives/list/python-dev@python.org/message/XF3IRRYDYAHV7YAV4YNRB6EY3HVKDEBM/ Code of Conduct: http://python.org/psf/codeofconduct/