homepage

This issue tracker has been migrated to GitHub , and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: IDLE: add current directory to open_module
Type: behavior Stage: test needed
Components: IDLE Versions: Python 3.10
process
Status: open Resolution:
Dependencies: 18055 Superseder:
Assigned To: terry.reedy Nosy List: markroseman, roger.serwy, terry.reedy
Priority: normal Keywords:

Created on 2013年05月25日 21:36 by terry.reedy, last changed 2022年04月11日 14:57 by admin.

Messages (3)
msg190012 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2013年05月25日 21:36
The point of File / Open Module is to look at the source for a module that has been, could be, or will be imported. The problem is that open_module is executed in the idle process while imports are executed in the user process, with the current directory prepended to sys.module.
The problem was already noted in the source, line 675.
 # XXX Ought to insert current file's directory in front of path
The augmentation of sys.path and subsequent restoration of the original could be done in a context manager that might be useful elsewhere. For 3.3,3.4, I think the change should be done after the patch in #18055, to not invalidate that patch. It would need to located in a slightly different place in 2.7, which will not be changed by that issue.
msg190057 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2013年05月26日 03:48
Code also suggests that this function should be elsewhere, such as in iobinding. This should be in the same place as regular open, wherever that is, since it is an alternative open.
Document should be upgraded a bit: "Load module opens Python-coded modules on sys.path in an editor window. The default name is the currently selected text, if any."
Tests should be added with this issue. This is the smallest dialog, and the structure of the revised code (#18055) gives a skeleton for a testcase: test_python_module (window open), test_builtin_module (Exception), test_bad_path (different Exception), and maybe even test_bad loader. We should look at tkinter tests for simulating name entry and click.
msg296372 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2017年06月19日 20:38
For IDLE development, I would love to have idlelib and idlelib.idle_test on the open line. Perhaps this should be user configurable: Favorite directories for opening files.
History
Date User Action Args
2022年04月11日 14:57:46adminsetgithub: 62264
2020年06月06日 22:20:53terry.reedysetversions: + Python 3.10, - Python 3.6, Python 3.7
2017年06月19日 20:38:43terry.reedysetassignee: terry.reedy
components: + IDLE
versions: + Python 3.6, Python 3.7, - Python 2.7, Python 3.3, Python 3.4
2017年06月19日 20:38:22terry.reedysetmessages: + msg296372
2015年09月18日 16:31:15markrosemansetnosy: + markroseman
2013年05月26日 03:48:37terry.reedysetmessages: + msg190057
2013年05月25日 21:36:38terry.reedysetdependencies: + Stop using imp in IDLE
2013年05月25日 21:36:20terry.reedycreate

AltStyle によって変換されたページ (->オリジナル) /