-
Notifications
You must be signed in to change notification settings - Fork 14
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
PyFilesystem2 dependency causes pkg_resources ImportError with Python 3.12 #41
Comments
I have now encountered this issue: PyFilesystem/pyfilesystem2#577 in a Python 3.12 environment, which is the default in Ubuntu 24.04.
I refactored to avoid usage of PyFatFS and use PyFat directly, but now I get this error when importing FatIO because it imports If it was not for the default argument, then this import would not even be necessary and we could simply rubber-type! Therefore, a quick fix could look like this: --- FatIO.py 2024-09-15 20:21:04.000000000 +0200
+++ FatIO.py 2024-09-15 21:45:27.968480300 +0200
@@ -6,18 +6,25 @@
import threading
from typing import Union, Optional
-from fs.mode import Mode
from pyfatfs import PyFATException
from pyfatfs.PyFat import PyFat
+class DefaultModeReadOnly:
+ def __init__(self):
+ self.truncate = False
+ self.appending = False
+ self.reading = True
+ self.writing = False
+
+
class FatIO(io.RawIOBase):
"""Wrap basic I/O operations for PyFat."""
def __init__(self, fs: PyFat,
path: str,
- mode: Mode = Mode('r')) -> None:
+ mode = DefaultModeReadOnly()) -> None:
"""Wrap basic I/O operations for PyFat. **Currently read-only**.
:param fs: `PyFat`: Instance of opened filesystem |
Hello,
this project looks really cool and I wanted to integrate it as a backend into ratarmount, if you are not opposed to that. However, while looking into it, I saw that the dependency PyFilesystem2 seems to not have received updates since 2 years ago.
In the ReadMe, a low-level API is mentioned, which I assume is the PyFat.py file as opposed to the PyFatFS file / PyFilesystem2 URI opening. I would like to use those without have
fs
as a dependency. Would that be possible?PyFilesystem2 would have to be taken out of the pyproject somehow. But, having it as an optional dependency also seems clunky, ... I guess one could split the project into two subprojects on PyPI to avoid that, e.g. pyfatfs and pyfatfs_ll. But even then,
PyFatIO.py
importsfs.mode
. This also would have to be abstracted to get rid of the dependency. This seems to be the only import of fs, so it might be easier than thought to use it withoutfs
.The text was updated successfully, but these errors were encountered: