I feel very confused. How am I supposed to read/wr...
# prefect-getting-started
b
I feel very confused. How am I supposed to read/write files on S3, using the S3 block?
Copy code
from prefect.filesystems import S3

s3_block = S3.load("data-warehouse")
s3_block.read_path("test.txt")

>>> AttributeError: 'coroutine' object has no attribute 'read_path'
1
j
Hi Baker. Here’s a Moving data guide that uses the S3Bucket block from the prefect-aws library for reading and writing data from S3.
b
Thank you. Also, I just figured that I probably cannot use these blocks functions outside of a task or flow, right?
So my initial test and error is probably meaningless
n
you can, its just that
load
is async if you're in an async context, so you have to await it
🙌 1
b
in that context, is there any reason to install
prefect-aws
instead of using:
from prefect.filesystems import S3
and
S3.load(...)
?
I didn't notice a functional difference when trying both
👍 1
j
The
S3
block that ships with Prefect is fine to use. The
S3Bucket
block has some additional functionality and the methods are different. You’re welcome to use whichever meets your needs - the guide just used
S3Bucket
.