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

AttributeError: 'S3VFSFile' object has no attribute 'xSectorSize' #24

Closed
blueshed opened this issue Mar 13, 2024 · 3 comments · Fixed by #25
Closed

AttributeError: 'S3VFSFile' object has no attribute 'xSectorSize' #24

blueshed opened this issue Mar 13, 2024 · 3 comments · Fixed by #25

Comments

@blueshed
Copy link

I found this error on OSX with python3.10 and python3.12

Traceback (most recent call last):
File "src/vfs.c", line 2580, in apswvfsfile_xSectorSize
AttributeError: 'S3VFSFile' object has no attribute 'xSectorSize'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "sample.py", line 16, in
with apsw.Connection(key_prefix, vfs=s3vfs.name) as db:
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "src/vfs.c", line 2580, in apswvfsfile_xSectorSize
AttributeError: 'S3VFSFile' object has no attribute 'xSectorSize'

I found this error when I ran the sample code in your readme. I was able to workaround it by adding:

class S3VFSFile:
...
    def xSectorSize(self):
            return self._block_size
...

to 'sqlite_s3vfs.py'

@michalc
Copy link
Member

michalc commented Mar 13, 2024

Hi @blueshed,

Thanks for the report, and I can reproduce the error.

I suspect it's due to a change in apsw (a dependency of sqlite-s3vfs). From some brief testing the latest version that seems to work is apsw==3.43.1.0, but anything after gives the error you mention.

Will see if we can fix it (e.g. by incorporating the change you suggest). In the meantime, I recommend using sqlite-s3vfs with apsw 3.43.1.0 (or earlier)

Michal

michalc added a commit that referenced this issue Mar 13, 2024
michalc added a commit that referenced this issue Mar 13, 2024
It looks like from apsw 3.43.1.1 onwards, the virtual filesystem file needs the
xSectorSize function. Inheriting from apsw.VFSFile seems to sort it - it has
reasonable default implementations from what I can tell.

Closes #24
michalc added a commit that referenced this issue Mar 13, 2024
It looks like from apsw 3.43.1.1 onwards, the virtual filesystem file needs the
xSectorSize function.

Closes #24
michalc added a commit that referenced this issue Mar 13, 2024
It looks like from apsw 3.43.1.1 onwards, the virtual filesystem file needs the
xSectorSize function.

Closes #24
michalc added a commit that referenced this issue Mar 13, 2024
It looks like from apsw 3.43.1.1 onwards, the virtual filesystem file needs the
xSectorSize function.

Nothing in the apsw changelog at https://rogerbinns.github.io/apsw/changes.html
makes this particular clear - the issue from 3.43.1.1 onwards was determined by
running the tests for sqlite-s3vfs for each apsw version.

Thank you to https://github.com/blueshed for the report and the fix.

Closes #24
michalc added a commit that referenced this issue Mar 13, 2024
It looks like from apsw 3.43.1.1 onwards, the virtual filesystem file needs the
xSectorSize function.

Nothing in the apsw changelog at https://rogerbinns.github.io/apsw/changes.html
makes this particular clear - the issue from 3.43.1.1 onwards was determined by
running the tests for sqlite-s3vfs for each apsw version.

The sector size of "0" for some reason is the only one that makes the rollback
tests pass

Thank you to https://github.com/blueshed for the report

Closes #24
@michalc
Copy link
Member

michalc commented Mar 13, 2024

Fixed and releasing now in v0.0.36

@blueshed
Copy link
Author

So quick - just ran on python3.12 - thank you so much.

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