Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Exported requirements.txt contains spurious error message, making it unparseable #4109

Closed
3 tasks done
colindean opened this issue May 26, 2021 · 2 comments · Fixed by #4110
Closed
3 tasks done

Exported requirements.txt contains spurious error message, making it unparseable #4109

colindean opened this issue May 26, 2021 · 2 comments · Fixed by #4110
Labels
kind/bug Something isn't working as expected

Comments

@colindean
Copy link
Contributor

  • I am on the latest Poetry version.

  • I have searched the issues of this repo and believe that this is not a duplicate.

  • 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 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

self.line(
"<warning>"
"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."
"</warning>"
)

should be self.line_error which, according to the docstring for that method outputs to stderr instead of stdout.

@colindean colindean added kind/bug Something isn't working as expected status/triage This issue needs to be triaged labels May 26, 2021
@colindean colindean changed the title Warning Exported requirements.txt contains spurious error message, making it unparseable May 26, 2021
colindean added a commit to colindean/poetry that referenced this issue May 26, 2021
An error in export could emit error messages to stdout, causing the requirements.txt output to stdout to be invalid.

Fixes python-poetry#4109
finswimmer pushed a commit that referenced this issue Sep 3, 2021
* Emit export errors to stderr to prevent invalid output

An error in export could emit error messages to stdout, causing the requirements.txt output to stdout to be invalid.

Fixes #4109

* Looks at stderr for export tests
@colindean
Copy link
Contributor Author

Thank you!

1nF0rmed pushed a commit to 1nF0rmed/poetry that referenced this issue Nov 15, 2021
…#4110)

* Emit export errors to stderr to prevent invalid output

An error in export could emit error messages to stdout, causing the requirements.txt output to stdout to be invalid.

Fixes python-poetry#4109

* Looks at stderr for export tests
edvardm pushed a commit to edvardm/poetry that referenced this issue Nov 24, 2021
…#4110)

* Emit export errors to stderr to prevent invalid output

An error in export could emit error messages to stdout, causing the requirements.txt output to stdout to be invalid.

Fixes python-poetry#4109

* Looks at stderr for export tests
@abn abn removed the status/triage This issue needs to be triaged label Mar 3, 2022
Copy link

github-actions bot commented Mar 2, 2024

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 2, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
kind/bug Something isn't working as expected
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants