Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>Did you get your answers? </p> <p>One way to debug python exceptions is to move (or copy temporarily for debugging) the code out of the try block. You'll get a full trace.</p> <p>And of course another way is to reduce the test case. Here I've reduced the problems to three lines, and tried the solution hinted at by @s.lott (using 'f:' in the getopts call), and also show at the end how calling with some different test data behaves:</p> <pre><code>$ cat x1.py import sys, getopt opts, args = getopt.getopt(sys.argv[1:],'fdmse:d',['files=','data-source=','mode=','start','end']) print "opts=", opts, "args=", args $ python x1.py -f=dummy.csv argblah Traceback (most recent call last): File "x1.py", line 2, in &lt;module&gt; opts, args = getopt.getopt(sys.argv[1:],'fdmse:d',['files=','data-source=','mode=','start','end']) File "/usr/lib/python2.6/getopt.py", line 91, in getopt opts, args = do_shorts(opts, args[0][1:], shortopts, args[1:]) File "/usr/lib/python2.6/getopt.py", line 191, in do_shorts if short_has_arg(opt, shortopts): File "/usr/lib/python2.6/getopt.py", line 207, in short_has_arg raise GetoptError('option -%s not recognized' % opt, opt) getopt.GetoptError: option -= not recognized $ sed 's/fdm/f:dm/' &lt;x1.py &gt;x2.py $ diff x1.py x2.py 2c2 &lt; opts, args = getopt.getopt(sys.argv[1:],'fdmse:d',['files=','data-source=','mode=','start','end']) --- &gt; opts, args = getopt.getopt(sys.argv[1:],'f:dmse:d',['files=','data-source=','mode=','start','end']) $ python x2.py -f=dummy.csv argblah opts= [('-f', '=dummy.csv')] args= ['argblah'] $ python x1.py -f dummy.csv argblah opts= [('-f', '')] args= ['dummy.csv', 'argblah'] </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload