We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
Exported requirements.txt contains spurious error message, making it unparseable
- [X] I am on the [latest](https://github.com/python-poetry/poetry/releases/latest) Poetry version.
- [X] I have searched the [issues](https://github.com/python-poetry/poetry/issues) of this repo and believe that this is not a duplicate.
- [X] If an exception occurs when executing a command, I executed it again in debug mode (`-vvv` option).

- **OS version and name**: macOS 10.15.7
- **Poetry version**: 1.1.6
- **Link of a [Gist](https://gist.github.com/) with the contents of your pyproject.toml file**: Too much internal stuff to share, it's not really related, though

## Issue

When I run `poetry export > requirements.txt && pip install -r requirements.txt`, I see this:

```
 Invalid requirement: 'Warning: The lock file is not up to date with the latest changes in pyproject.toml. You may be getting outdated dependencies. Run update to update them.' (from line 1 of requirements.txt)
```

It appears that my Poetry lockfile is out of sync. No biggie, that's correctable and logged in #3092 when it's not necessary to resync.

However, this error message should not make it into the output of the `poetry export` command. That error log line should go to stderr, not stdout.

## Proposed Fix

I think that the `self.line` here https://github.com/python-poetry/poetry/blob/b753aaf4c3c08ef0e54941a6616fe318fdf4f6e4/poetry/console/commands/export.py#L56-L63
should be `self.line_error` which, according to the [docstring for that method](https://github.com/sdispater/cleo/blob/9d289bf709ab2119b58e95da58a655ab70661798/cleo/commands/command.py#L262-L276) outputs to stderr instead of stdout.

--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `poetry/console/commands/export.py`
Content:
```
1 from cleo.helpers import option
2 
3 from poetry.utils.exporter import Exporter
4 
5 from .command import Command
6 
7 
8 class ExportCommand(Command):
9 
10     name = "export"
11     description = "Exports the lock file to alternative formats."
12 
13     options = [
14         option(
15             "format",
16             "f",
17             "Format to export to. Currently, only requirements.txt is supported.",
18             flag=False,
19             default=Exporter.FORMAT_REQUIREMENTS_TXT,
20         ),
21         option("output", "o", "The name of the output file.", flag=False),
22         option("without-hashes", None, "Exclude hashes from the exported file."),
23         option("dev", None, "Include development dependencies."),
24         option(
25             "extras",
26             "E",
27             "Extra sets of dependencies to include.",
28             flag=False,
29             multiple=True,
30         ),
31         option("with-credentials", None, "Include credentials for extra indices."),
32     ]
33 
34     def handle(self) -> None:
35         fmt = self.option("format")
36 
37         if fmt not in Exporter.ACCEPTED_FORMATS:
38             raise ValueError("Invalid export format: {}".format(fmt))
39 
40         output = self.option("output")
41 
42         locker = self.poetry.locker
43         if not locker.is_locked():
44             self.line("<comment>The lock file does not exist. Locking.</comment>")
45             options = []
46             if self.io.is_debug():
47                 options.append(("-vvv", None))
48             elif self.io.is_very_verbose():
49                 options.append(("-vv", None))
50             elif self.io.is_verbose():
51                 options.append(("-v", None))
52 
53             self.call("lock", " ".join(options))
54 
55         if not locker.is_fresh():
56             self.line(
57                 "<warning>"
58                 "Warning: The lock file is not up to date with "
59                 "the latest changes in pyproject.toml. "
60                 "You may be getting outdated dependencies. "
61                 "Run update to update them."
62                 "</warning>"
63             )
64 
65         exporter = Exporter(self.poetry)
66         exporter.export(
67             fmt,
68             self.poetry.file.parent,
69             output or self.io,
70             with_hashes=not self.option("without-hashes"),
71             dev=self.option("dev"),
72             extras=self.option("extras"),
73             with_credentials=self.option("with-credentials"),
74         )
75
```
--- END FILES ---

Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.

Here is an example:

```diff
diff --git a/examples/server_async.py b/examples/server_async.py
--- a/examples/server_async.py
+++ b/examples/server_async.py
@@ -313,4 +313,4 @@
 
 
 if __name__ == "__main__":
-    asyncio.run(run_async_server("."), debug=True)
+    asyncio.run(run_async_server(), debug=True)
diff --git a/examples/server_sync.py b/examples/server_sync.py
--- a/examples/server_sync.py
+++ b/examples/server_sync.py
@@ -313,5 +313,5 @@
 
 
 if __name__ == "__main__":
-    server = run_sync_server(".")
+    server = run_sync_server()
     server.shutdown()

```

diff --git a/poetry/console/commands/export.py b/poetry/console/commands/export.py
--- a/poetry/console/commands/export.py
+++ b/poetry/console/commands/export.py
@@ -41,7 +41,7 @@
 
         locker = self.poetry.locker
         if not locker.is_locked():
-            self.line("<comment>The lock file does not exist. Locking.</comment>")
+            self.line_error("<comment>The lock file does not exist. Locking.</comment>")
             options = []
             if self.io.is_debug():
                 options.append(("-vvv", None))
@@ -53,7 +53,7 @@
             self.call("lock", " ".join(options))
 
         if not locker.is_fresh():
-            self.line(
+            self.line_error(
                 "<warning>"
                 "Warning: The lock file is not up to date with "
                 "the latest changes in pyproject.toml. "

{"golden_diff": "diff --git a/poetry/console/commands/export.py b/poetry/console/commands/export.py\n--- a/poetry/console/commands/export.py\n+++ b/poetry/console/commands/export.py\n@@ -41,7 +41,7 @@\n \n         locker = self.poetry.locker\n         if not locker.is_locked():\n-            self.line(\"<comment>The lock file does not exist. Locking.</comment>\")\n+            self.line_error(\"<comment>The lock file does not exist. Locking.</comment>\")\n             options = []\n             if self.io.is_debug():\n                 options.append((\"-vvv\", None))\n@@ -53,7 +53,7 @@\n             self.call(\"lock\", \" \".join(options))\n \n         if not locker.is_fresh():\n-            self.line(\n+            self.line_error(\n                 \"<warning>\"\n                 \"Warning: The lock file is not up to date with \"\n                 \"the latest changes in pyproject.toml. \"\n", "issue": "Exported requirements.txt contains spurious error message, making it unparseable\n- [X] I am on the [latest](https://github.com/python-poetry/poetry/releases/latest) Poetry version.\r\n- [X] I have searched the [issues](https://github.com/python-poetry/poetry/issues) of this repo and believe that this is not a duplicate.\r\n- [X] If an exception occurs when executing a command, I executed it again in debug mode (`-vvv` option).\r\n\r\n- **OS version and name**: macOS 10.15.7\r\n- **Poetry version**: 1.1.6\r\n- **Link of a [Gist](https://gist.github.com/) with the contents of your pyproject.toml file**: Too much internal stuff to share, it's not really related, though\r\n\r\n## Issue\r\n\r\nWhen I run `poetry export > requirements.txt && pip install -r requirements.txt`, I see this:\r\n\r\n```\r\n Invalid requirement: 'Warning: The lock file is not up to date with the latest changes in pyproject.toml. You may be getting outdated dependencies. Run update to update them.' (from line 1 of requirements.txt)\r\n```\r\n\r\nIt appears that my Poetry lockfile is out of sync. No biggie, that's correctable and logged in #3092 when it's not necessary to resync.\r\n\r\nHowever, this error message should not make it into the output of the `poetry export` command. That error log line should go to stderr, not stdout.\r\n\r\n## Proposed Fix\r\n\r\nI think that the `self.line` here https://github.com/python-poetry/poetry/blob/b753aaf4c3c08ef0e54941a6616fe318fdf4f6e4/poetry/console/commands/export.py#L56-L63\r\nshould be `self.line_error` which, according to the [docstring for that method](https://github.com/sdispater/cleo/blob/9d289bf709ab2119b58e95da58a655ab70661798/cleo/commands/command.py#L262-L276) outputs to stderr instead of stdout.\n", "before_files": [{"content": "from cleo.helpers import option\n\nfrom poetry.utils.exporter import Exporter\n\nfrom .command import Command\n\n\nclass ExportCommand(Command):\n\n    name = \"export\"\n    description = \"Exports the lock file to alternative formats.\"\n\n    options = [\n        option(\n            \"format\",\n            \"f\",\n            \"Format to export to. Currently, only requirements.txt is supported.\",\n            flag=False,\n            default=Exporter.FORMAT_REQUIREMENTS_TXT,\n        ),\n        option(\"output\", \"o\", \"The name of the output file.\", flag=False),\n        option(\"without-hashes\", None, \"Exclude hashes from the exported file.\"),\n        option(\"dev\", None, \"Include development dependencies.\"),\n        option(\n            \"extras\",\n            \"E\",\n            \"Extra sets of dependencies to include.\",\n            flag=False,\n            multiple=True,\n        ),\n        option(\"with-credentials\", None, \"Include credentials for extra indices.\"),\n    ]\n\n    def handle(self) -> None:\n        fmt = self.option(\"format\")\n\n        if fmt not in Exporter.ACCEPTED_FORMATS:\n            raise ValueError(\"Invalid export format: {}\".format(fmt))\n\n        output = self.option(\"output\")\n\n        locker = self.poetry.locker\n        if not locker.is_locked():\n            self.line(\"<comment>The lock file does not exist. Locking.</comment>\")\n            options = []\n            if self.io.is_debug():\n                options.append((\"-vvv\", None))\n            elif self.io.is_very_verbose():\n                options.append((\"-vv\", None))\n            elif self.io.is_verbose():\n                options.append((\"-v\", None))\n\n            self.call(\"lock\", \" \".join(options))\n\n        if not locker.is_fresh():\n            self.line(\n                \"<warning>\"\n                \"Warning: The lock file is not up to date with \"\n                \"the latest changes in pyproject.toml. \"\n                \"You may be getting outdated dependencies. \"\n                \"Run update to update them.\"\n                \"</warning>\"\n            )\n\n        exporter = Exporter(self.poetry)\n        exporter.export(\n            fmt,\n            self.poetry.file.parent,\n            output or self.io,\n            with_hashes=not self.option(\"without-hashes\"),\n            dev=self.option(\"dev\"),\n            extras=self.option(\"extras\"),\n            with_credentials=self.option(\"with-credentials\"),\n        )\n", "path": "poetry/console/commands/export.py"}], "after_files": [{"content": "from cleo.helpers import option\n\nfrom poetry.utils.exporter import Exporter\n\nfrom .command import Command\n\n\nclass ExportCommand(Command):\n\n    name = \"export\"\n    description = \"Exports the lock file to alternative formats.\"\n\n    options = [\n        option(\n            \"format\",\n            \"f\",\n            \"Format to export to. Currently, only requirements.txt is supported.\",\n            flag=False,\n            default=Exporter.FORMAT_REQUIREMENTS_TXT,\n        ),\n        option(\"output\", \"o\", \"The name of the output file.\", flag=False),\n        option(\"without-hashes\", None, \"Exclude hashes from the exported file.\"),\n        option(\"dev\", None, \"Include development dependencies.\"),\n        option(\n            \"extras\",\n            \"E\",\n            \"Extra sets of dependencies to include.\",\n            flag=False,\n            multiple=True,\n        ),\n        option(\"with-credentials\", None, \"Include credentials for extra indices.\"),\n    ]\n\n    def handle(self) -> None:\n        fmt = self.option(\"format\")\n\n        if fmt not in Exporter.ACCEPTED_FORMATS:\n            raise ValueError(\"Invalid export format: {}\".format(fmt))\n\n        output = self.option(\"output\")\n\n        locker = self.poetry.locker\n        if not locker.is_locked():\n            self.line_error(\"<comment>The lock file does not exist. Locking.</comment>\")\n            options = []\n            if self.io.is_debug():\n                options.append((\"-vvv\", None))\n            elif self.io.is_very_verbose():\n                options.append((\"-vv\", None))\n            elif self.io.is_verbose():\n                options.append((\"-v\", None))\n\n            self.call(\"lock\", \" \".join(options))\n\n        if not locker.is_fresh():\n            self.line_error(\n                \"<warning>\"\n                \"Warning: The lock file is not up to date with \"\n                \"the latest changes in pyproject.toml. \"\n                \"You may be getting outdated dependencies. \"\n                \"Run update to update them.\"\n                \"</warning>\"\n            )\n\n        exporter = Exporter(self.poetry)\n        exporter.export(\n            fmt,\n            self.poetry.file.parent,\n            output or self.io,\n            with_hashes=not self.option(\"without-hashes\"),\n            dev=self.option(\"dev\"),\n            extras=self.option(\"extras\"),\n            with_credentials=self.option(\"with-credentials\"),\n        )\n", "path": "poetry/console/commands/export.py"}]}