Poetry: 'PosixPath' object has no attribute 'endswith'

Created on 28 Jun 2020  路  4Comments  路  Source: python-poetry/poetry

  • [x] I am on the latest Poetry version.
  • [x] I have searched the 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).

Issue


[AttributeError]
'PosixPath' object has no attribute 'endswith'

Traceback (most recent call last):
  File "/Users/akarshjain/.poetry/lib/poetry/_vendor/py2.7/clikit/console_application.py", line 131, in run
    status_code = command.handle(parsed_args, io)
  File "/Users/akarshjain/.poetry/lib/poetry/_vendor/py2.7/clikit/api/command/command.py", line 120, in handle
    status_code = self._do_handle(args, io)
  File "/Users/akarshjain/.poetry/lib/poetry/_vendor/py2.7/clikit/api/command/command.py", line 171, in _do_handle
    return getattr(handler, handler_method)(args, io, self)
  File "/Users/akarshjain/.poetry/lib/poetry/_vendor/py2.7/cleo/commands/command.py", line 92, in wrap_handle
    return self.handle()
  File "/Users/akarshjain/.poetry/lib/poetry/console/commands/install.py", line 69, in handle
    return_code = installer.run()
  File "/Users/akarshjain/.poetry/lib/poetry/installation/installer.py", line 74, in run
    self._do_install(local_repo)
  File "/Users/akarshjain/.poetry/lib/poetry/installation/installer.py", line 286, in _do_install
    self._execute(op)
  File "/Users/akarshjain/.poetry/lib/poetry/installation/installer.py", line 302, in _execute
    getattr(self, '_execute_{}'.format(method))(operation)
  File "/Users/akarshjain/.poetry/lib/poetry/installation/installer.py", line 327, in _execute_install
    self._installer.install(operation.package)
  File "/Users/akarshjain/.poetry/lib/poetry/installation/pip_installer.py", line 90, in install
    req = self.requirement(package)
  File "/Users/akarshjain/.poetry/lib/poetry/installation/pip_installer.py", line 146, in requirement
    req = os.path.join(package.root_dir, package.source_url)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/posixpath.py", line 70, in join
    elif path == '' or path.endswith('/'):

Adding source distribution as a dependency to pyproject.toml, I encountered this error.
Looks like python 2.7 compatibility issue.

Bug

Most helpful comment

I was getting this issue, but since upgrading to v1.0.10 it's fixed.

All 4 comments

Same behaviour with poetry add /path/to/mylib. Can confirm this works as expected if I downgrade to poetry 1.0.8.

Also happening (v1.0.9) with adding a local dep in tar.gz format.

Example:
poetry add packages/my-package-1.0.0.tar.gz

Downgrading to 1.0.8 and re-ran the above command & everything worked as expected.

I was getting this issue, but since upgrading to v1.0.10 it's fixed.

Resolved with #2582

Was this page helpful?
0 / 5 - 0 ratings

Related issues

alexlatchford picture alexlatchford  路  3Comments

nikaro picture nikaro  路  3Comments

AWegnerGitHub picture AWegnerGitHub  路  3Comments

jeremy886 picture jeremy886  路  3Comments

etijskens picture etijskens  路  3Comments