Terry J. Reedy added the comment:
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.
----------
_______________________________________
Python tracker <[email protected]>
<http://bugs.python.org/issue27452>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com