Skip to content

Instantly share code, notes, and snippets.

@rhizoome
Created April 8, 2016 15:12
Show Gist options
  • Save rhizoome/0f440ce3dda19635988695dfbedd91ac to your computer and use it in GitHub Desktop.
Save rhizoome/0f440ce3dda19635988695dfbedd91ac to your computer and use it in GitHub Desktop.
check_output can fail with ValueError
Traceback (most recent call last):
File "/home/ganwell/.pyenv/versions/3.5.1/bin/structureshrink", line 9, in <module>
load_entry_point('structureshrink==0.0.1', 'console_scripts', 'structureshrink')()
File "/home/ganwell/.pyenv/versions/3.5.1/lib/python3.5/site-packages/click/core.py", line 716, in __call__
return self.main(*args, **kwargs)
File "/home/ganwell/.pyenv/versions/3.5.1/lib/python3.5/site-packages/click/core.py", line 696, in main
rv = self.invoke(ctx)
File "/home/ganwell/.pyenv/versions/3.5.1/lib/python3.5/site-packages/click/core.py", line 889, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "/home/ganwell/.pyenv/versions/3.5.1/lib/python3.5/site-packages/click/core.py", line 534, in invoke
return callback(*args, **kwargs)
File "/home/ganwell/.pyenv/versions/3.5.1/lib/python3.5/site-packages/structureshrink/__main__.py", line 250, in shrinker
shrinker.shrink()
File "/home/ganwell/.pyenv/versions/3.5.1/lib/python3.5/site-packages/structureshrink/shrinker.py", line 163, in shrink
lambda ls: self.classify(ngram.join(ls)) == label
File "/home/ganwell/.pyenv/versions/3.5.1/lib/python3.5/site-packages/structureshrink/shrinker.py", line 291, in _lsmin
ls = _expmin(ls, criterion)
File "/home/ganwell/.pyenv/versions/3.5.1/lib/python3.5/site-packages/structureshrink/shrinker.py", line 330, in _expmin
if criterion(s):
File "/home/ganwell/.pyenv/versions/3.5.1/lib/python3.5/site-packages/structureshrink/shrinker.py", line 163, in <lambda>
lambda ls: self.classify(ngram.join(ls)) == label
File "/home/ganwell/.pyenv/versions/3.5.1/lib/python3.5/site-packages/structureshrink/shrinker.py", line 87, in classify
result = self.__classify(preprocessed)
File "/home/ganwell/.pyenv/versions/3.5.1/lib/python3.5/site-packages/structureshrink/__main__.py", line 132, in classify_data
test, timeout=timeout, stdin=subprocess.DEVNULL)
File "/home/ganwell/.pyenv/versions/3.5.1/lib/python3.5/subprocess.py", line 629, in check_output
**kwargs).stdout
File "/home/ganwell/.pyenv/versions/3.5.1/lib/python3.5/subprocess.py", line 701, in run
stdout, stderr = process.communicate()
File "/home/ganwell/.pyenv/versions/3.5.1/lib/python3.5/subprocess.py", line 1068, in communicate
stdout, stderr = self._communicate(input, endtime, timeout)
File "/home/ganwell/.pyenv/versions/3.5.1/lib/python3.5/subprocess.py", line 1693, in _communicate
selector.register(self.stdout, selectors.EVENT_READ)
File "/home/ganwell/.pyenv/versions/3.5.1/lib/python3.5/selectors.py", line 342, in register
key = super().register(fileobj, events, data)
File "/home/ganwell/.pyenv/versions/3.5.1/lib/python3.5/selectors.py", line 228, in register
key = SelectorKey(fileobj, self._fileobj_lookup(fileobj), events, data)
File "/home/ganwell/.pyenv/versions/3.5.1/lib/python3.5/selectors.py", line 215, in _fileobj_lookup
return _fileobj_to_fd(fileobj)
File "/home/ganwell/.pyenv/versions/3.5.1/lib/python3.5/selectors.py", line 39, in _fileobj_to_fd
"{!r}".format(fileobj)) from None
ValueError: Invalid file object: <_io.BufferedReader name=5>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment