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
I was using file.put() with a directory destination and switched it to a file.template(). That resulted in the following traceback:
File "/home/rsyring/.local/pipx/venvs/kilo/lib/python3.11/site-packages/pyinfra/operations/files.py", line 938, in put
dest = unix_path_join(dest, os.path.basename(src))
^^^^^^^^^^^^^^^^^^^^^
File "<frozen posixpath>", line 142, in basenameTypeError: expected str, bytes or os.PathLike object, not StringIO
Once I figured out what was going on, the fix was to specify the dest as a file path, which makes sense.
Requests:
A better error message indicating the root problem, i.e. "When using IO-like object for src a directory can not be used as the dest."
Maybe not worth the effort, but when using files.template() and the dest is a directory, source the file name from the src file and add that to the dest before calling files.put(). Removing '.j2' or '.jinja' if present on the src filename.
The text was updated successfully, but these errors were encountered:
I was using
file.put()
with a directory destination and switched it to afile.template()
. That resulted in the following traceback:Once I figured out what was going on, the fix was to specify the dest as a file path, which makes sense.
Requests:
src
a directory can not be used as thedest
."files.template()
and the dest is a directory, source the file name from the src file and add that to the dest before callingfiles.put()
. Removing '.j2' or '.jinja' if present on the src filename.The text was updated successfully, but these errors were encountered: