You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
A clear and concise description of what the bug is.
files.put() breaks when dest is a pathlib.Path instead of a string. I understand that a string is expected here, but this is not explicitly stated in the docs. Adding datatypes to all of the docs would be ideal.
To Reproduce
Steps to reproduce the behavior, please include where possible:
Operation code & usage
Target system information
Example using the @docker connector (helps isolate the problem)
import os
from pathlib import Path
from pyinfra.operations import files
files.put(
src="foo.txt",
dest=Path("/data") / "tmp/",
)
Error output:
--> An internal exception occurred:
File "/data/home/su_nwestern/repos/pkg_pyinfra/pyinfra/pyinfra/operations/util/files.py", line 11, in <listcomp>
part_list[0:-1] = [part.rstrip("/") for part in part_list[0:-1]]
^^^^^^^^^^^^^^^^^
AttributeError: 'PosixPath' object has no attribute 'rstrip'
Expected behavior
A clear and concise description of what you expected to happen.
Describe the bug
A clear and concise description of what the bug is.
files.put()
breaks whendest
is apathlib.Path
instead of a string. I understand that a string is expected here, but this is not explicitly stated in the docs. Adding datatypes to all of the docs would be ideal.To Reproduce
Steps to reproduce the behavior, please include where possible:
@docker
connector (helps isolate the problem)Error output:
Expected behavior
A clear and concise description of what you expected to happen.
Behave the same as if
dest
was a stringMeta
Include output of
pyinfra --support
.How was pyinfra installed (source/pip)?
Include pyinfra-debug.log (if one was created)
Consider including output with
-vv
and--debug
.System: Linux
Platform: Linux-4.18.0-553.22.1.el8_10.x86_64-x86_64-with-glibc2.28
Release: 4.18.0-553.22.1.el8_10.x86_64
Machine: x86_64
pyinfra: v3.1.1
black: v24.4.2
black: v24.4.2
click: v8.1.7
configparser: v7.1.0
coverage: v7.5.1
coverage: v7.5.1
distro: v1.9.0
flake8: v7.0.0
flake8: v7.0.0
flake8-black: v0.3.6
flake8-black: v0.3.6
flake8-isort: v6.1.1
flake8-isort: v6.1.1
flake8-spellcheck: v0.12.1
gevent: v24.10.1
importlib-metadata: v8.5.0
ipdb: v0.13.13
ipdbplugin: v1.5.0
ipython: v8.28.0
isort: v5.13.2
isort: v5.13.2
jinja2: v3.1.4
mypy: v1.11.2
mypy: v1.11.2
myst-parser: v2.0.0
myst-parser: v2.0.0
packaging: v23.2
paramiko: v3.5.0
pyinfra-guzzle-sphinx-theme: v0.16
pyinfra-guzzle-sphinx-theme: v0.16
pytest: v8.2.1
pytest: v8.2.1
pytest-cov: v5.0.0
pytest-cov: v5.0.0
python-dateutil: v2.9.0.post0
pywinrm: v0.5.0
redbaron: v0.9.2
setuptools: v65.5.1
sphinx: v6.2.1
sphinx: v6.2.1
twine: v5.1.1
typeguard: v4.3.0
types-PyYAML: v6.0.12.20240917
types-PyYAML: v6.0.12.20240917
types-cryptography: v3.3.23.2
types-cryptography: v3.3.23.2
types-paramiko: v3.5.0.20240928
types-paramiko: v3.5.0.20240928
types-python-dateutil: v2.9.0.20241003
types-python-dateutil: v2.9.0.20241003
types-setuptools: v75.1.0.20240917
types-setuptools: v75.1.0.20240917
typing-extensions: v4.12.2
wheel: v0.44.0
Executable: /data/home/su_nwestern/.local/bin/pyinfra
Python: 3.11.9 (CPython, GCC 8.5.0 20210514 (Red Hat 8.5.0-22))
The text was updated successfully, but these errors were encountered: