Author terry.reedy
Recipients python-dev, serhiy.storchaka, terry.reedy
Date 2016-07-06.01:55:35
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1467770137.1.0.775883290054.issue27452@psf.upfronthosting.co.za>
In-reply-to
Content
Ah, the invocation I did not test ;-).  It does not matter in this case because "os.path.dirname('config.py')" is '' and the join leaves relative names for the config files that work fine for opening them.

F:\Python\dev\36\Lib\idlelib>..\..\pcbuild\win32\python_d.exe config.py

 {'keys': <__main__.IdleConfParser object at 0x000002633B200080>,
  ... 

At one time, I thought, sys.path[0] was '', representing the current directory, and not the absolute path of the starting directory.  I am not sure if there are any cross platform, cross implementation, guarantees. 

There are 12 other idlelib files using __file__.  I ran each in either idlelib or idle_test as appropriate.  11 run. test_help.py fails at this line (which I wrote)
  helpfile = join(abspath(dirname(dirname(__file__))), 'help.html')
as the double dirname does not have the expected effect. A version of the conditional from config, with dirname(sys.path[0]), would work.  However, taking the abspath first is easier.
  helpfile = join(dirname(dirname(abspath(__file__))), 'help.html')

The comment in config appears to refer to the exec command/function.  I don't know what either does with __name__, __file__, or sys.path.

---
With the two IdleConf dict keys sorted, the first patch results in consistent output.  configparser.ConfigParser uses OrderedDicts by default, so re-running on unchanged files results in unchanged iteration order.
History
Date User Action Args
2016-07-06 01:55:37terry.reedysetrecipients: + terry.reedy, python-dev, serhiy.storchaka
2016-07-06 01:55:37terry.reedysetmessageid: <1467770137.1.0.775883290054.issue27452@psf.upfronthosting.co.za>
2016-07-06 01:55:37terry.reedylinkissue27452 messages
2016-07-06 01:55:35terry.reedycreate