Repository: conda/conda

Issue:
Regression: cannot install from explicit conda package filenames
This command used to work, but now it gives the following error/traceback:

Example: `conda install bzip2-1.0.6-vc14_3.tar.bz2 --dry-run`

```
An unexpected error has occurred.
Please consider posting the following information to the
conda GitHub issue tracker at:

    https://github.com/conda/conda/issues



Current conda install:

               platform : win-64
          conda version : 4.2.12
       conda is private : False
      conda-env version : 4.2.12
    conda-build version : 2.0.7
         python version : 3.5.2.final.0
       requests version : 2.10.0
       root environment : C:\Miniconda3  (writable)
    default environment : C:\Miniconda3\envs\test_conda
       envs directories : C:\Miniconda3\envs
          package cache : C:\Miniconda3\pkgs
           channel URLs : https://repo.continuum.io/pkgs/free/win-64
                          https://repo.continuum.io/pkgs/free/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 : None
           offline mode : False



`$ C:\Miniconda3\Scripts\conda-script.py install bzip2-1.0.6-vc14_3.tar.bz2 --dry-run`




    Traceback (most recent call last):
      File "C:\Miniconda3\lib\site-packages\conda\exceptions.py", line 479, in conda_exception_handler
        return_value = func(*args, **kwargs)
      File "C:\Miniconda3\lib\site-packages\conda\cli\main.py", line 145, in _main
        exit_code = args.func(args, p)
      File "C:\Miniconda3\lib\site-packages\conda\cli\main_install.py", line 80, in execute
        install(args, parser, 'install')
      File "C:\Miniconda3\lib\site-packages\conda\cli\install.py", line 209, in install
        explicit(args.packages, prefix, verbose=not context.quiet)
      File "C:\Miniconda3\lib\site-packages\conda\misc.py", line 66, in explicit
        if not is_url(url_p):
      File "C:\Miniconda3\lib\site-packages\conda\common\url.py", line 72, in is_url
        p = urlparse(url)
      File "C:\Miniconda3\lib\site-packages\conda\_vendor\auxlib\decorators.py", line 56, in _memoized_func
        result = func(*args, **kwargs)
      File "C:\Miniconda3\lib\site-packages\conda\common\url.py", line 55, in urlparse
        if on_win and url.startswith('file:'):
    AttributeError: 'NoneType' object has no attribute 'startswith'
```


Discussion:
Definitely looks like a bug.  And I'm really confused why regression tests didn't already catch this.

What happens if you actually install the file and don't use `--dry-run`?

```
conda install bzip2-1.0.6-vc14_3.tar.bz2
```

Same thing?

It happens the same thing, with the same traceback. I've tried a lot of other different options (`--force`, `--use-local`, etc.), with no avail.

This just bit me as well. I'm working in an air-gapped environment, and can't install anything.
@soapy1 If you have time, this is definitely fair game for you to find a fix for.  And also figure out why all of the integration tests for this in `test_create.py` aren't catching it!!!
This has to be due to a regression in `is_url` used on [this line](https://github.com/conda/conda/blob/master/conda/misc.py#L69). For a local tarball, `url_p` should be `None`, so `is_url` needs to be able to handle that case.
Yes, that's exactly the problem. The [current version of `is_url`](https://github.com/conda/conda/blob/master/conda/common/url.py#L73) no longer handles a `None` input. The [previous version](https://github.com/conda/conda/commit/90a79764482dcfeb075c3b6b30164ceb86d3bebe#diff-32acb1ec31b5dbb2bafea7655667e908L178) explicitly did so.
Thanks @mcg1969 

Resolving patch:
diff --git a/conda/common/url.py b/conda/common/url.py
--- a/conda/common/url.py
+++ b/conda/common/url.py
@@ -68,6 +68,8 @@ def url_to_s3_info(url):
 
 
 def is_url(url):
+    if not url:
+        return False
     try:
         p = urlparse(url)
         return p.netloc is not None or p.scheme == "file"


Test patch: