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

"TypeError: argument should be a path or str object, not <class 'py._path.local.LocalPath'>" with Python 3.5 #3

Closed
mikenerone opened this issue Sep 17, 2020 · 7 comments · Fixed by #4

Comments

@mikenerone
Copy link
Contributor

mikenerone commented Sep 17, 2020

As both tox and poetry support Python 3.5 (for now), I presume this plugin should, as well. Currently, this error results when it executes under Python 3.5:

$ tox
.tox create: /Users/mikenerone/dev/threatq/pynoceros/.tox/.tox
.tox installdeps: poetry-core>=1.0.0a5, tox-poetry-dev-dependencies, tox >= 3.20.0
Traceback (most recent call last):
  File "/Users/mikenerone/.pyenv/versions/3.5.5/lib/python3.5/runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "/Users/mikenerone/.pyenv/versions/3.5.5/lib/python3.5/runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "/Users/mikenerone/dev/threatq/pynoceros/.tox/.tox/lib/python3.5/site-packages/tox/__main__.py", line 4, in <module>
    tox.cmdline()
  File "/Users/mikenerone/dev/threatq/pynoceros/.tox/.tox/lib/python3.5/site-packages/tox/session/__init__.py", line 44, in cmdline
    main(args)
  File "/Users/mikenerone/dev/threatq/pynoceros/.tox/.tox/lib/python3.5/site-packages/tox/session/__init__.py", line 65, in main
    config = load_config(args)
  File "/Users/mikenerone/dev/threatq/pynoceros/.tox/.tox/lib/python3.5/site-packages/tox/session/__init__.py", line 81, in load_config
    config = parseconfig(args)
  File "/Users/mikenerone/dev/threatq/pynoceros/.tox/.tox/lib/python3.5/site-packages/tox/config/__init__.py", line 281, in parseconfig
    pm.hook.tox_configure(config=config)  # post process config object
  File "/Users/mikenerone/dev/threatq/pynoceros/.tox/.tox/lib/python3.5/site-packages/pluggy/hooks.py", line 286, in __call__
    return self._hookexec(self, self.get_hookimpls(), kwargs)
  File "/Users/mikenerone/dev/threatq/pynoceros/.tox/.tox/lib/python3.5/site-packages/pluggy/manager.py", line 93, in _hookexec
    return self._inner_hookexec(hook, methods, kwargs)
  File "/Users/mikenerone/dev/threatq/pynoceros/.tox/.tox/lib/python3.5/site-packages/pluggy/manager.py", line 87, in <lambda>
    firstresult=hook.spec.opts.get("firstresult") if hook.spec else False,
  File "/Users/mikenerone/dev/threatq/pynoceros/.tox/.tox/lib/python3.5/site-packages/pluggy/callers.py", line 208, in _multicall
    return outcome.get_result()
  File "/Users/mikenerone/dev/threatq/pynoceros/.tox/.tox/lib/python3.5/site-packages/pluggy/callers.py", line 80, in get_result
    raise ex[1].with_traceback(ex[2])
  File "/Users/mikenerone/dev/threatq/pynoceros/.tox/.tox/lib/python3.5/site-packages/pluggy/callers.py", line 187, in _multicall
    res = hook_impl.function(*args)
  File "/Users/mikenerone/dev/threatq/pynoceros/.tox/.tox/lib/python3.5/site-packages/tox_poetry_dev_dependencies/_hooks.py", line 37, in tox_configure
    requirements = _get_dev_requirements(config.setupdir)
  File "/Users/mikenerone/dev/threatq/pynoceros/.tox/.tox/lib/python3.5/site-packages/tox_poetry_dev_dependencies/_hooks.py", line 56, in _get_dev_requirements
    poetry_ = poetry_factory.create_poetry(project_root_path)
  File "/Users/mikenerone/dev/threatq/pynoceros/.tox/.tox/lib/python3.5/site-packages/poetry/core/factory.py", line 23, in create_poetry
    poetry_file = self.locate(cwd)
  File "/Users/mikenerone/dev/threatq/pynoceros/.tox/.tox/lib/python3.5/site-packages/poetry/core/factory.py", line 197, in locate
    candidates = [Path(cwd)]
  File "/Users/mikenerone/.pyenv/versions/3.5.5/lib/python3.5/pathlib.py", line 969, in __new__
    self = cls._from_parts(args, init=False)
  File "/Users/mikenerone/.pyenv/versions/3.5.5/lib/python3.5/pathlib.py", line 651, in _from_parts
    drv, root, parts = self._parse_args(args)
  File "/Users/mikenerone/.pyenv/versions/3.5.5/lib/python3.5/pathlib.py", line 643, in _parse_args
    % type(a))
TypeError: argument should be a path or str object, not <class 'py._path.local.LocalPath'>

I'll submit a trivial pull request to resolve this shortly.

@sinoroc
Copy link
Owner

sinoroc commented Sep 17, 2020

Thanks for the bug report (and for giving this code a chance to begin with).

@sinoroc
Copy link
Owner

sinoroc commented Sep 17, 2020

Seems to me like Python 3.5 has already reached its end of life, hasn't it? I'm not entirely clear on the situation. I'm a bit reluctant to add code for older Python versions. Do you really need this, must have or nice to have?

@mikenerone
Copy link
Contributor Author

mikenerone commented Sep 17, 2020

Well, it just EOL'd this week, so still deserves a little love. :P My vote is for supporting it for as long as the two projects this bridges does. Sadly, due to deployment constraints, I'm stuck using 3.5 for one particular project for a bit longer. For me it's a must-have, else I simply can't use the plugin (short of forking it, which seems silly for such a tiny change). This is the right way to handle Poetry with tox (as opposed to using a poetry install call to "side-load" the dev deps), so I really want to use your plugin.

@sinoroc
Copy link
Owner

sinoroc commented Sep 17, 2020

Well, it just EOL'd this week, so still deserves a little love. :P My vote is for supporting it for as long as the two projects this bridges does. Sadly, due to deployment constraints, I'm stuck using 3.5 for one particular project for a bit longer. For me it's a must-have, else I simply can't use the plugin (short of forking it, which seems silly for such a tiny change).

Should be fixed in version 0.0.1.

This is the right way to handle Poetry with tox (as opposed to using a poetry install call to "side-load" the dev deps)

Agreed. Hopefully I managed to convince others as well that Poetry's FAQ is counter-productive (or at least misleading) on this topic, and that there should be a better way.

@mikenerone
Copy link
Contributor Author

@sinoroc There's already been some discussion of doing exactly what you've done here. I think you'll find Poetry's maintainers relatively receptive.

@mikenerone
Copy link
Contributor Author

Ah, I was referring to Discord. See https://github.com/python-poetry/poetry .

sinoroc added a commit that referenced this issue Nov 9, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants