scikit-learn: Exception thrown when running example 'Classification of text documents using sparse data'
Description
When the running this example, it throws an exception at the line:
(opts, args) = op.parse_args()
Expected Results
The bar plot indicating the accuracy, training time (normalized) and test time (normalized) of each classifier.
Actual Results
Usage: __main__.py [options]
__main__.py: error: no such option: -f
Trackback:
/usr/lib/python2.7/optparse.pyc in parse_args(self, args, values)
1400 stop = self._process_args(largs, rargs, values)
1401 except (BadOptionError, OptionValueError), err:
-> 1402 self.error(str(err))
1403
1404 args = largs + rargs
/usr/lib/python2.7/optparse.pyc in error(self, msg)
1582 """
1583 self.print_usage(sys.stderr)
-> 1584 self.exit(2, "%s: error: %s\n" % (self.get_prog_name(), msg))
1585
1586 def get_usage(self):
/usr/lib/python2.7/optparse.pyc in exit(self, status, msg)
1572 if msg:
1573 sys.stderr.write(msg)
-> 1574 sys.exit(status)
1575
1576 def error(self, msg):
SystemExit: 2
Versions
Linux-3.19.0-15-generic-x86_64-with-Ubuntu-15.04-vivid Python 2.7.9 (default, Apr 2 2015, 15:33:21) [GCC 4.9.2] NumPy 1.11.2 SciPy 0.18.1 Scikit-Learn 0.18
About this issue
- Original URL
- State: closed
- Created 8 years ago
- Comments: 16 (16 by maintainers)
Good catch, hmm not sure what to do, to be honest. I am wondering whether setting
sys.argv[1:] = []
inside a notebook could be a good enough work-around … or maybe just encourage example writers to have simpler examples.I guess part of the more general issue is that we do not run the notebooks that we generate … We could do that at the very least in the sphinx-gallery tests.
The good news is that some people are indeed using the notebooks generated by sphinx-gallery 😉 !