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 am trying to copy between filesystems, I see that #227 exists, that will be amazing when it comes!
In the meantime I would still like to copy between filesystems, I wrote some code like this,
source_uri=UPath('some_file')
target_uri=UPath('s3://test/some_file')
with (source_uri.open('rb') assource,
target_uri.open('wb') astarget):
target.write(source)
but get the error TypeError: a bytes-like object is required, not '_io.BufferedReader..since target.write seemingly should accept a readable buffer I am not sure why the error here.
The workaround I have come up with looks like this, feel kind of wrong to implement it in python loop though.
with (source_uri.open('rb') assource,
target_uri.open('wb') astarget):
whilex:=source.read(target_uri.fs.blocksize):
target.write(x)
Is there something obviously wrong with my initial implementation or is there a better approach for the workaround?
Cheers!
The text was updated successfully, but these errors were encountered:
Hi, great project :)
I am trying to copy between filesystems, I see that #227 exists, that will be amazing when it comes!
In the meantime I would still like to copy between filesystems, I wrote some code like this,
but get the error
TypeError: a bytes-like object is required, not '_io.BufferedReader
..since target.write seemingly should accept a readable buffer I am not sure why the error here.The workaround I have come up with looks like this, feel kind of wrong to implement it in python loop though.
Is there something obviously wrong with my initial implementation or is there a better approach for the workaround?
Cheers!
The text was updated successfully, but these errors were encountered: