Repository: conda/conda-build

Issue:
conda convert -p all fail with csv.Error
First seen at https://travis-ci.org/Ecpy/ecpy/jobs/209330731 and reproduced locally on the same repository. I also noticed that running conversion one target at a time succeeds but running two in the same command will fail if the first one target win-32 or win-64 even if the second is also windows. Hope this will help narrow down the source.

Traceback:
```
Traceback (most recent call last):
  File "/home/travis/anaconda/bin/conda-convert", line 6, in <module>
    sys.exit(conda_build.cli.main_convert.main())
  File "/home/travis/anaconda/lib/python3.6/site-packages/conda_build/cli/main_convert.py", line 129, in main
    return execute(sys.argv[1:])
  File "/home/travis/anaconda/lib/python3.6/site-packages/conda_build/cli/main_convert.py", line 125, in execute
    api.convert(f, **args.__dict__)
  File "/home/travis/anaconda/lib/python3.6/site-packages/conda_build/api.py", line 231, in convert
    dry_run=dry_run, dependencies=dependencies)
  File "/home/travis/anaconda/lib/python3.6/site-packages/conda_build/convert.py", line 449, in conda_convert
    file_map = get_pure_py_file_map(t, platform)
  File "/home/travis/anaconda/lib/python3.6/site-packages/conda_build/convert.py", line 268, in get_pure_py_file_map
    csv_dialect = csv.Sniffer().sniff(has_prefix_files)
  File "/home/travis/anaconda/lib/python3.6/csv.py", line 188, in sniff
    raise Error("Could not determine delimiter")
_csv.Error: Could not determine delimiter
```

Conda infos are:
```
Current conda install:

               platform : linux-64
          conda version : 4.3.14
       conda is private : False
      conda-env version : 4.3.14
    conda-build version : 2.1.6
         python version : 3.6.0.final.0
       requests version : 2.12.4
       root environment : /home/travis/anaconda  (writable)
    default environment : /home/travis/anaconda
       envs directories : /home/travis/anaconda/envs
                          /home/travis/.conda/envs
          package cache : /home/travis/anaconda/pkgs
                          /home/travis/.conda/pkgs
           channel URLs : https://repo.continuum.io/pkgs/free/linux-64
                          https://repo.continuum.io/pkgs/free/noarch
                          https://repo.continuum.io/pkgs/r/linux-64
                          https://repo.continuum.io/pkgs/r/noarch
                          https://repo.continuum.io/pkgs/pro/linux-64
                          https://repo.continuum.io/pkgs/pro/noarch
                          https://conda.anaconda.org/ecpy/linux-64
                          https://conda.anaconda.org/ecpy/noarch
            config file : /home/travis/.condarc
           offline mode : False
             user-agent : conda/4.3.14 requests/2.12.4 CPython/3.6.0 Linux/4.8.12-040812-generic debian/jessie/sid glibc/2.19
                UID:GID : 1000:1000

# conda environments:
#
root                  *  /home/travis/anaconda

sys.version: 3.6.0 |Continuum Analytics, Inc.| (defau...
sys.prefix: /home/travis/anaconda
sys.executable: /home/travis/anaconda/bin/python
conda location: /home/travis/anaconda/lib/python3.6/site-packages/conda
conda-build: /home/travis/anaconda/bin/conda-build
conda-convert: /home/travis/anaconda/bin/conda-convert
conda-develop: /home/travis/anaconda/bin/conda-develop
conda-env: /home/travis/anaconda/bin/conda-env
conda-index: /home/travis/anaconda/bin/conda-index
conda-inspect: /home/travis/anaconda/bin/conda-inspect
conda-metapackage: /home/travis/anaconda/bin/conda-metapackage
conda-render: /home/travis/anaconda/bin/conda-render
conda-server: /home/travis/anaconda/bin/conda-server
conda-sign: /home/travis/anaconda/bin/conda-sign
conda-skeleton: /home/travis/anaconda/bin/conda-skeleton
conda-verify: /home/travis/anaconda/bin/conda-verify
user site dirs: 

CIO_TEST: <not set>
CONDA_DEFAULT_ENV: <not set>
CONDA_ENVS_PATH: <not set>
LD_LIBRARY_PATH: <not set>
PATH: /home/travis/anaconda/bin:/home/travis/.rvm/gems/ruby-2.3.1/bin:/home/travis/.rvm/gems/ruby-2.3.1@global/bin:/home/travis/.rvm/rubies/ruby-2.3.1/bin:/home/travis/.rvm/bin:/home/travis/bin:/home/travis/.local/bin:/home/travis/.pyenv/shims:/home/travis/.phpenv/shims:/home/travis/gopath/bin:/home/travis/.local/bin:/opt/pyenv/bin:/opt/python/2.7.12/bin:/opt/python/3.5.2/bin:/usr/local/phantomjs/bin:/usr/local/phantomjs:/home/travis/perl5/perlbrew/bin:/home/travis/.nvm/versions/node/v6.3.0/bin:./node_modules/.bin:/usr/local/maven-3.1.1/bin:/home/travis/.kiex/elixirs/elixir-1.0.4/bin:/home/travis/.kiex/bin:/usr/local/gradle/bin:/usr/local/clang-3.5.0/bin:/home/travis/.gimme/versions/go1.6.3.linux.amd64/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/home/travis/.phpenv/bin
PYTHONHOME: <not set>
PYTHONPATH: <not set>

WARNING: could not import _license.show_info
# try:
# $ conda install -n root _license
```


Discussion:
Thanks for reporting.  I'm not sure what this is at first glance, but I'll look into it.
The package I try to convert has an entry point. Running the same check on a package having no entry point I do not see any issue.

Resolving patch:
diff --git a/conda_build/convert.py b/conda_build/convert.py
--- a/conda_build/convert.py
+++ b/conda_build/convert.py
@@ -265,7 +265,12 @@ def get_pure_py_file_map(t, platform):
         has_prefix_files = t.extractfile("info/has_prefix").read().decode()
     if has_prefix_files:
         fieldnames = ['prefix', 'type', 'path']
-        csv_dialect = csv.Sniffer().sniff(has_prefix_files)
+        try:
+            csv_dialect = csv.Sniffer().sniff(has_prefix_files)
+        except csv.Error:
+            # should be a tab-delimited file.  Not completely sure whether text editors may have
+            #    replaced tabs with spaces, though
+            csv_dialect = csv.excel_tab
         csv_dialect.lineterminator = '\n'
         for attr in ('delimiter', 'quotechar'):
             if PY3 and hasattr(getattr(csv_dialect, attr), 'decode'):


Test patch: