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 <rep...@bugs.python.org> <http://bugs.python.org/issue5680> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com