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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

More specific error message when project name contains disallowed characters #565

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

MolarFox
Copy link

@MolarFox MolarFox commented Mar 14, 2023

Context

Recently I was working on a project using poetry, and ended up in a state where I was unable to use poetry build, due to getting a "No file/folder found for package <project_name>" error repeatedly, despite the folder structure etc being correct to what poetry expects to see

After a bunch of google searching and diving into the source code myself, I was able to see that the cause was that the project name I was using was "molpro-dirman", containing an illegal - character. Once I sussed this out and changed all the project naming to use an underscore instead, everything worked nominally.

In this change I've added an error trap and more specific error message when this case arises for the next person 馃檪

Changes

  • Catch specific subcase where dir not found due to substitution of disallowed chars
    • Log more specific error message in this case

Checklist

  • Added tests for changed code. (n/a / minor error trapping code change only)
  • Updated documentation for changed code. (n/a / minor change / self-documenting changes)

@sonarcloud
Copy link

sonarcloud bot commented Mar 14, 2023

Kudos, SonarCloud Quality Gate passed!聽 聽 Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
No Duplication information No Duplication information

@dimbleby
Copy link
Contributor

You've misunderstood something. Not only are hyphens allowed in project names, this very project has a hyphen in its project name:

name = "poetry-core"

Also your pull request has nothing much to do with what you've reported: a hyphen is not an uppercase underscore!

@dimbleby
Copy link
Contributor

dimbleby commented Mar 14, 2023

Perhaps you could usefully include module._name in the existing exception, I don't think we need a new exception.

Wants a unit test case.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants