# Buggy code
def search_packages(self, reference=None, remote=None, query=None, outdated=False):
    """Return the single information saved in conan.vars about all the packages
    or the packages which match with a pattern

    Attributes:
        pattern = string to match packages
        remote = search on another origin to get packages info
        packages_pattern = String query with binary
                           packages properties: "arch=x86 AND os=Windows"
    """
    if remote:
        remote = RemoteRegistry(self._client_cache.registry, self._user_io).remote(
            remote
        )
        packages_props = self._remote_manager.search_packages(remote, reference, query)
        ordered_packages = OrderedDict(sorted(packages_props.items()))
        manifest = self._remote_manager.get_conan_digest(reference, remote)
        recipe_hash = manifest.summary_hash
    else:
        searcher = DiskSearchManager(self._client_cache)
        packages_props = searcher.search_packages(reference, query)
        ordered_packages = OrderedDict(sorted(packages_props.items()))
        try:
            recipe_hash = self._client_cache.load_manifest(reference).summary_hash
        except IOError:  # It could not exist in local
            recipe_hash = None
    if outdated and recipe_hash:
        ordered_packages = filter_outdated(ordered_packages, recipe_hash)
    return ordered_packages, reference, recipe_hash, query


# Traceback (AttributeError)
(conan) ~ $ conan search zlib/1.2.11@conan/stable -r=conan-center
Traceback (most recent call last):
File "/home/mgodbolt/apps/miniconda/envs/conan/lib/python2.7/site-packages/conans/client/command.py", line 1131, in run
method(args[0][1:])
File "/home/mgodbolt/apps/miniconda/envs/conan/lib/python2.7/site-packages/conans/client/command.py", line 814, in search
outdated=args.outdated)
File "/home/mgodbolt/apps/miniconda/envs/conan/lib/python2.7/site-packages/conans/client/conan_api.py", line 64, in wrapper
return f(*args, **kwargs)
File "/home/mgodbolt/apps/miniconda/envs/conan/lib/python2.7/site-packages/conans/client/conan_api.py", line 595, in search_packages
outdated=outdated)
File "/home/mgodbolt/apps/miniconda/envs/conan/lib/python2.7/site-packages/conans/client/cmd/search.py", line 44, in search_packages
remote = RemoteRegistry(self._client_cache.registry, self._user_io).remote(remote)
File "/home/mgodbolt/apps/miniconda/envs/conan/lib/python2.7/site-packages/conans/client/remote_registry.py", line 95, in remote
remotes, _ = self._load()
File "/home/mgodbolt/apps/miniconda/envs/conan/lib/python2.7/site-packages/conans/client/remote_registry.py", line 65, in _load
self._output.warn("Remotes registry file missing, creating default one in %s"
AttributeError: 'UserIO' object has no attribute 'warn'

ERROR: 'UserIO' object has no attribute 'warn'

# Fixed code
def search_packages(self, reference=None, remote=None, query=None, outdated=False):
    """Return the single information saved in conan.vars about all the packages
    or the packages which match with a pattern

    Attributes:
        pattern = string to match packages
        remote = search on another origin to get packages info
        packages_pattern = String query with binary
                           packages properties: "arch=x86 AND os=Windows"
    """
    if remote:
        remote = RemoteRegistry(self._client_cache.registry, self._user_io.out).remote(
            remote
        )
        packages_props = self._remote_manager.search_packages(remote, reference, query)
        ordered_packages = OrderedDict(sorted(packages_props.items()))
        manifest = self._remote_manager.get_conan_digest(reference, remote)
        recipe_hash = manifest.summary_hash
    else:
        searcher = DiskSearchManager(self._client_cache)
        packages_props = searcher.search_packages(reference, query)
        ordered_packages = OrderedDict(sorted(packages_props.items()))
        try:
            recipe_hash = self._client_cache.load_manifest(reference).summary_hash
        except IOError:  # It could not exist in local
            recipe_hash = None
    if outdated and recipe_hash:
        ordered_packages = filter_outdated(ordered_packages, recipe_hash)
    return ordered_packages, reference, recipe_hash, query