ValueError: need more than 2 values to unpack

Issue #15 resolved
Allan Lei created an issue

I get this error for any commands I run.

  • Windows 7 Pro 64
  • Python 2.7.6 (default, Nov 10 2013, 19:24:24) [MSC v.1500 64 bit (AMD64)] on win32
  • pip install sarge==0.1.2

Simple run

sarge.run('echo abc')

Trying the test_sarge.py script from repo

PS C:\Users\allan.lei\Desktop> python test_sarge.py
E.EEEEE.E...EEE..EEEEEEEE....EException in thread Thread-3:
Traceback (most recent call last):
  File "C:\Python27\lib\threading.py", line 810, in __bootstrap_inner
    self.run()
  File "C:\Python27\lib\threading.py", line 763, in run
    self.__target(*self.__args, **self.__kwargs)
  File "C:\Python27\lib\site-packages\sarge\__init__.py", line 1055, in run_node
    result = getattr(self, method)(node, input, async)
  File "C:\Python27\lib\site-packages\sarge\__init__.py", line 1201, in run_command_node
    node.cmd.run(input=input, async=async)
  File "C:\Python27\lib\site-packages\sarge\__init__.py", line 593, in run
    self.process = p = Popen(self.args, **self.kwargs)
  File "C:\Python27\lib\subprocess.py", line 701, in __init__
    errread, errwrite), to_close = self._get_handles(stdin, stdout, stderr)
  File "C:\Python27\lib\site-packages\sarge\__init__.py", line 481, in _get_handles
    stderr)
ValueError: need more than 2 values to unpack

Exception in thread Thread-4:
Traceback (most recent call last):
  File "C:\Python27\lib\threading.py", line 810, in __bootstrap_inner
    self.run()
  File "C:\Python27\lib\threading.py", line 763, in run
    self.__target(*self.__args, **self.__kwargs)
  File "C:\Python27\lib\site-packages\sarge\__init__.py", line 1055, in run_node
    result = getattr(self, method)(node, input, async)
  File "C:\Python27\lib\site-packages\sarge\__init__.py", line 1289, in run_list_node
    self.run_node(curr, input, async=use_async)
  File "C:\Python27\lib\site-packages\sarge\__init__.py", line 1055, in run_node
    result = getattr(self, method)(node, input, async)
  File "C:\Python27\lib\site-packages\sarge\__init__.py", line 1201, in run_command_node
    node.cmd.run(input=input, async=async)
  File "C:\Python27\lib\site-packages\sarge\__init__.py", line 593, in run
    self.process = p = Popen(self.args, **self.kwargs)
  File "C:\Python27\lib\subprocess.py", line 701, in __init__
    errread, errwrite), to_close = self._get_handles(stdin, stdout, stderr)
  File "C:\Python27\lib\site-packages\sarge\__init__.py", line 481, in _get_handles
    stderr)
ValueError: need more than 2 values to unpack

Comments (10)

  1. Vinay Sajip repo owner

    I can't reproduce this: see the screenshot below.

    screenshot

    Did you ensure that echo.exe from the GnuWin32 coreutils package is available, as mentioned in the note in the docs here?

  2. Allan Lei reporter

    Yes. Tried both methods of putting it in the same execution directory and adding to PATH. Also tried echo abc from ipython. All work fine.

    https://www.dropbox.com/s/cq1qd07xpbcwl9d/Untitled.png

  3. Vinay Sajip repo owner

    It looks as if Python 2.7.6 changed how the Popen._get_handles method works. Do you know if it works with 2.7.5?

  4. Vinay Sajip repo owner

    I have committed a potential fix in changeset 5a4c641. Is it possible for you to install this revision and see if it fixes the problem? I don't have a 2.7.6 installation on Windows which I can test with.

  5. Log in to comment