Message269865
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. |
|
Date |
User |
Action |
Args |
2016-07-06 01:55:37 | terry.reedy | set | recipients:
+ terry.reedy, python-dev, serhiy.storchaka |
2016-07-06 01:55:37 | terry.reedy | set | messageid: <1467770137.1.0.775883290054.issue27452@psf.upfronthosting.co.za> |
2016-07-06 01:55:37 | terry.reedy | link | issue27452 messages |
2016-07-06 01:55:35 | terry.reedy | create | |
|