Repository: conda/conda

Issue:
An unexpected error has occurred.
Current conda install:

               platform : win-64
          conda version : 4.3.11
       conda is private : False
      conda-env version : 4.3.11
    conda-build version : 2.0.2
         python version : 2.7.12.final.0
       requests version : 2.13.0
       root environment : I:\Program Files\Anaconda2  (writable)
    default environment : I:\Program Files\Anaconda2
       envs directories : I:\Program Files\Anaconda2\envs
                          C:\Users\topnet\AppData\Local\conda\conda\envs
                          C:\Users\topnet\.conda\envs
          package cache : I:\Program Files\Anaconda2\pkgs
                          C:\Users\topnet\AppData\Local\conda\conda\pkgs
           channel URLs : https://conda.anaconda.org/conda-forge/win-64
                          https://conda.anaconda.org/conda-forge/noarch
                          https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/win-64
                          https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/noarch
                          https://repo.continuum.io/pkgs/free/win-64
                          https://repo.continuum.io/pkgs/free/noarch
                          https://repo.continuum.io/pkgs/r/win-64
                          https://repo.continuum.io/pkgs/r/noarch
                          https://repo.continuum.io/pkgs/pro/win-64
                          https://repo.continuum.io/pkgs/pro/noarch
                          https://repo.continuum.io/pkgs/msys2/win-64
                          https://repo.continuum.io/pkgs/msys2/noarch
            config file : C:\Users\topnet\.condarc
           offline mode : False
             user-agent : conda/4.3.11 requests/2.13.0 CPython/2.7.12 Windows/10 Windows/10.0.14393



`$ I:\Program Files\Anaconda2\Scripts\conda-script.py install numpy`




    Traceback (most recent call last):
      File "I:\Program Files\Anaconda2\lib\site-packages\conda\exceptions.py", line 616, in conda_exception_handler
        return_value = func(*args, **kwargs)
      File "I:\Program Files\Anaconda2\lib\site-packages\conda\cli\main.py", line 137, in _main
        exit_code = args.func(args, p)
      File "I:\Program Files\Anaconda2\lib\site-packages\conda\cli\main_install.py", line 80, in execute
        install(args, parser, 'install')
      File "I:\Program Files\Anaconda2\lib\site-packages\conda\cli\install.py", line 359, in install
        execute_actions(actions, index, verbose=not context.quiet)
      File "I:\Program Files\Anaconda2\lib\site-packages\conda\plan.py", line 825, in execute_actions
        execute_instructions(plan, index, verbose)
      File "I:\Program Files\Anaconda2\lib\site-packages\conda\instructions.py", line 258, in execute_instructions
        cmd(state, arg)
      File "I:\Program Files\Anaconda2\lib\site-packages\conda\instructions.py", line 111, in PROGRESSIVEFETCHEXTRACT_CMD
        progressive_fetch_extract.execute()
      File "I:\Program Files\Anaconda2\lib\site-packages\conda\core\package_cache.py", line 470, in execute
        self._execute_action(action)
      File "I:\Program Files\Anaconda2\lib\site-packages\conda\core\package_cache.py", line 486, in _execute_action
        exceptions.append(CondaError(repr(e)))
      File "I:\Program Files\Anaconda2\lib\site-packages\conda\__init__.py", line 43, in __repr__
        return '%s: %s\n' % (self.__class__.__name__, text_type(self))
      File "I:\Program Files\Anaconda2\lib\site-packages\conda\__init__.py", line 46, in __str__
        return text_type(self.message % self._kwargs)
    TypeError: not enough arguments for format string

thanks！


Discussion:
Do you face the same error with Conda v4.3.14? Could you please attach output for:
```
I:\Program Files\Anaconda2\Scripts\conda-script.py install numpy -vvv
```

Resolving patch:
diff --git a/conda/__init__.py b/conda/__init__.py
--- a/conda/__init__.py
+++ b/conda/__init__.py
@@ -44,7 +44,19 @@ def __repr__(self):
         return '%s: %s' % (self.__class__.__name__, text_type(self))
 
     def __str__(self):
-        return text_type(self.message % self._kwargs)
+        try:
+            return text_type(self.message % self._kwargs)
+        except TypeError:
+            # TypeError: not enough arguments for format string
+            debug_message = "\n".join((
+                "class: " + self.__class__.__name__,
+                "message:",
+                self.message,
+                "kwargs:",
+                text_type(self._kwargs),
+            ))
+            sys.stderr.write(debug_message)
+            raise
 
     def dump_map(self):
         result = dict((k, v) for k, v in iteritems(vars(self)) if not k.startswith('_'))


Test patch: