Repository: conan-io/conan

Issue:
conan inspect fails if not remotes.json exists
Another bug while trying to replicate this:

```
$ rm -rf .conan\remotes.json

$ conan inspect zlib/1.2.11@ --raw=version
Traceback (most recent call last):
  File "c:\users\memsharded\envs\conanpip37\lib\site-packages\conans\client\command.py", line 1969, in run
    method(args[0][1:])
  File "c:\users\memsharded\envs\conanpip37\lib\site-packages\conans\client\command.py", line 255, in inspect
    result = self._conan.inspect(args.path_or_reference, attributes, args.remote, quiet=quiet)
  File "c:\users\memsharded\envs\conanpip37\lib\site-packages\conans\client\conan_api.py", line 81, in wrapper
    return f(api, *args, **kwargs)
  File "c:\users\memsharded\envs\conanpip37\lib\site-packages\conans\client\conan_api.py", line 260, in inspect
    remotes = self.app.load_remotes(remote_name=remote_name)
  File "c:\users\memsharded\envs\conanpip37\lib\site-packages\conans\client\conan_api.py", line 198, in load_remotes
    remotes = self.cache.registry.load_remotes()
  File "c:\users\memsharded\envs\conanpip37\lib\site-packages\conans\client\cache\remote_registry.py", line 313, in load_remotes
    "creating default one in %s" % self._filename)
  File "c:\users\memsharded\envs\conanpip37\lib\site-packages\conans\client\output.py", line 121, in warn
    self.writeln("WARN: {}".format(data), Color.BRIGHT_YELLOW, error=True)
  File "c:\users\memsharded\envs\conanpip37\lib\site-packages\conans\client\output.py", line 74, in writeln
    self.write(data, front, back, newline=True, error=error)
  File "c:\users\memsharded\envs\conanpip37\lib\site-packages\conans\client\output.py", line 99, in write
    self._write_err(data, newline)
  File "c:\users\memsharded\envs\conanpip37\lib\site-packages\conans\client\output.py", line 84, in _write_err
    self._stream_err.write(data)
AttributeError: 'bool' object has no attribute 'write'

ERROR: 'bool' object has no attribute 'write'
```

_Originally posted by @memsharded in https://github.com/conan-io/conan/issues/6554#issuecomment-587503508_


Discussion:
If possible, try to address also the issue in https://github.com/conan-io/conan/issues/6554#issuecomment-587495678 (WARN message in --raw)

Resolving patch:
diff --git a/conans/client/conan_api.py b/conans/client/conan_api.py
--- a/conans/client/conan_api.py
+++ b/conans/client/conan_api.py
@@ -73,7 +73,7 @@ def wrapper(api, *args, **kwargs):
         quiet = kwargs.pop("quiet", False)
         old_curdir = get_cwd()
         old_output = api.user_io.out
-        quiet_output = ConanOutput(StringIO(), api.color) if quiet else None
+        quiet_output = ConanOutput(StringIO(), color=api.color) if quiet else None
         try:
             api.create_app(quiet_output=quiet_output)
             log_command(f.__name__, kwargs)


Test patch:
diff --git a/conans/test/functional/command/inspect_test.py b/conans/test/functional/command/inspect_test.py
--- a/conans/test/functional/command/inspect_test.py
+++ b/conans/test/functional/command/inspect_test.py
@@ -438,3 +438,11 @@ class Lib(ConanFile):
         client.save({"conanfile.py": conanfile})
         client.run("inspect . --raw=default_options")
         self.assertEqual("dict=True\nlist=False", client.out)
+
+    def test_initial_inspect_without_registry_test(self):
+        client = TestClient()
+        client.save({"conanfile.py": self.conanfile})
+        client.run("export . user/channel")
+        os.remove(client.cache.remotes_path)
+        client.run("inspect MyPkg/1.2.3@user/channel --raw=version")
+        self.assertIn("1.2.3", client.out)