Skip to content

poetry init - Pressing <enter> at "Enter package # to add ..." causes AttributeError: 'NoneType' object has no attribute 'replace' #2355

@asottile

Description

@asottile
  • 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). (it made no difference in the output)
  • OS version and name: ubuntu 18.04
  • Poetry version: 1.0.5
  • Link of a Gist with the contents of your pyproject.toml file: N/A

Issue

$ poetry init

This command will guide you through creating your pyproject.toml config.

Package name [y]:  
Version [0.1.0]:  
Description []:  
Author [Anthony Sottile <[email protected]>, n to skip]:  
License []:  
Compatible Python versions [^3.6]:  

Would you like to define your main dependencies interactively? (yes/no) [yes] 
You can specify a package in the following forms:
  - A single name (requests)
  - A name and a constraint (requests ^2.23.0)
  - A git url (git+https://github.com/python-poetry/poetry.git)
  - A git url with a revision (git+https://github.com/python-poetry/poetry.git#develop)
  - A file path (../my-package/my-package.whl)
  - A directory (../my-package/)
  - An url (https://example.com/packages/my-package-0.1.0.tar.gz)

Search for package to add (or leave blank to continue): 

Would you like to define your development dependencies interactively? (yes/no) [yes] 
Search for package to add (or leave blank to continue): astpretty
Found 3 packages matching astpretty

Enter package # to add, or the complete package name if it is not listed: 
 [0] astpretty
 [1] asteria
 [2] moshmosh-base
 > 
'NoneType' object has no attribute 'replace'

Enter package # to add, or the complete package name if it is not listed: 
 [0] astpretty
 [1] asteria
 [2] moshmosh-base
 > 

very minor, but I expect a human-readable error message instead, or to default to the first one (it was an exact name match after all!)

Metadata

Metadata

Assignees

No one assigned

    Labels

    area/cliRelated to the command linearea/error-handlingBad error messages/insufficient error handlingarea/initRelated to 'poetry init'/project creationarea/uxFeatures and improvements related to the user experience

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions