andrewferrier / cromer

Provide a wrapper around cron jobs to manage failure more gracefully

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Getting 'invalid file object' in subprocess.run() on occassion

andrewferrier opened this issue · comments

Traceback (most recent call last):
  File "/usr/local/bin/cromer", line 234, in <module>
    consider_executing_command(args, hashfile)
  File "/usr/local/bin/cromer", line 179, in consider_executing_command
    (stdout, stderr, returncode, timeout) = run_process(args.args, my_timeout)
  File "/usr/local/bin/cromer", line 148, in run_process
    completed_process = subprocess.run(args, stdout=subprocess.PIPE, stderr=subprocess.PIPE, timeout=my_timeout)
  File "/usr/local/Cellar/python3/3.5.0/Frameworks/Python.framework/Versions/3.5/lib/python3.5/subprocess.py", line 701, in run
    stdout, stderr = process.communicate()
  File "/usr/local/Cellar/python3/3.5.0/Frameworks/Python.framework/Versions/3.5/lib/python3.5/subprocess.py", line 1068, in communi
+cate
    stdout, stderr = self._communicate(input, endtime, timeout)
  File "/usr/local/Cellar/python3/3.5.0/Frameworks/Python.framework/Versions/3.5/lib/python3.5/subprocess.py", line 1689, in _commun
+icate
    selector.register(self.stdout, selectors.EVENT_READ)
  File "/usr/local/Cellar/python3/3.5.0/Frameworks/Python.framework/Versions/3.5/lib/python3.5/selectors.py", line 342, in register
    key = super().register(fileobj, events, data)
  File "/usr/local/Cellar/python3/3.5.0/Frameworks/Python.framework/Versions/3.5/lib/python3.5/selectors.py", line 228, in register
    key = SelectorKey(fileobj, self._fileobj_lookup(fileobj), events, data)
  File "/usr/local/Cellar/python3/3.5.0/Frameworks/Python.framework/Versions/3.5/lib/python3.5/selectors.py", line 215, in _fileobj_
+lookup
    return _fileobj_to_fd(fileobj)
  File "/usr/local/Cellar/python3/3.5.0/Frameworks/Python.framework/Versions/3.5/lib/python3.5/selectors.py", line 39, in _fileobj_t
+o_fd
    "{!r}".format(fileobj)) from None
ValueError: Invalid file object: <_io.BufferedReader name=6>