[issue5680] Command-line arguments when running in IDLE
Terry J. Reedy
report at bugs.python.org
Thu Apr 16 10:09:52 CEST 2015
Terry J. Reedy added the comment:
Pending application of a patch, the following will work to only add args to sys.argv when running from an Idle editor.
import sys
# ...
if __name__ == '__main__':
if 'idlelib.PyShell' in sys.modules:
sys.argv.extend(('a', '-2')) # add your argments here.
print(sys.argv) # in use, parse sys.argv after extending it
# ['C:\\Programs\\python34\\tem.py', 'a', '-2']
----------
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue5680>
_______________________________________
More information about the Python-bugs-list
mailing list