Author terry.reedy
Recipients Saimadhav.Heblikar, asvetlov, ggenellina, gpolo, markroseman, mrabarnett, rhettinger, terry.reedy, wolma
Date 2015-11-23.18:15:12
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1448302513.23.0.841526255947.issue5680@psf.upfronthosting.co.za>
In-reply-to
Content
Today on SO: https://stackoverflow.com/questions/33866724/read-data-from-file-idle.  Person writing script to open a file given on command line asks 'How to test from IDLE?' He found PyCharm, but I would like to add a better answer than the workaround I gave above.  It does not have to be either perfect or necessarily permanent.  There are two subissues.  

1) Get a command line from the user.  1a. What dialog?  1b. Retain it for as least the current session?  Same for all editors? Specific to file?

2) Use the command line.  2a. parse with shlex or custom parser. 2b integrate in ScriptBinding.py when starting user code so code sees arguments in sys.argv.

Looking *briefly* at the patches:

M.B.: Get command line with new extension module argumentDialog.py. Parse with re.findall(arg_regex).  Modifies ScriptBinding, including the deletin of a condition for setting user sys.argv.

G.G.: Get command line with tkSimpleDialog._QueryString. Split with shlex.  Reuses MB's ScriptBinding patch.

S.H.: Get command line with custom dialog. Use custom parser. Add new tests.

My inclination is to start as simple as possible.  Use a message box to get a single string (no error checking is needed).  Set for specific file only, not all.  The setting could be added to status bar.  Parse with shlex.  Question: is basic command line parsing system specific?  Does MAC stick with unix/posix rules?  Should shlex.split use non-posix mode on Windows?
History
Date User Action Args
2015-11-23 18:15:13terry.reedysetrecipients: + terry.reedy, rhettinger, ggenellina, gpolo, mrabarnett, asvetlov, markroseman, wolma, Saimadhav.Heblikar
2015-11-23 18:15:13terry.reedysetmessageid: <1448302513.23.0.841526255947.issue5680@psf.upfronthosting.co.za>
2015-11-23 18:15:13terry.reedylinkissue5680 messages
2015-11-23 18:15:12terry.reedycreate