Welcome!
This is the community forum for my apps Pythonista and Editorial.
For individual support questions, you can also send an email. If you have a very short question or just want to say hello — I'm @olemoritz on Twitter.
Google Drive connection falls in error in Pythonista beta: needs a temporary workaround
-
To @omz, @JonB or other guru: the Google Drive connection falls in error in Pythonista beta, due to an identified error in Pythonista code.
Could one of you provide a temporary workaround, like using swizzle, because it is very annoying for my regular processes.
Thanks a lot in advancePS paid by a beer at next meeting 😀
Traceback (most recent call last): File "/private/var/mobile/Containers/Shared/AppGroup/94C45A26-1F47-4486-9539-896F8F44AA91/Pythonista3/Documents/site-packages/GoogleDriveBrowser.py", line 347, in <module> main() File "/private/var/mobile/Containers/Shared/AppGroup/94C45A26-1F47-4486-9539-896F8F44AA91/Pythonista3/Documents/site-packages/GoogleDriveBrowser.py", line 300, in main gauth = GoogleAuth(google_drive_auth_path) File "/private/var/mobile/Containers/Shared/AppGroup/94C45A26-1F47-4486-9539-896F8F44AA91/Pythonista3/Documents/site-packages/pydrive/auth.py", line 169, in __init__ self.settings = LoadSettingsFile(settings_file) File "/private/var/mobile/Containers/Shared/AppGroup/94C45A26-1F47-4486-9539-896F8F44AA91/Pythonista3/Documents/site-packages/pydrive/settings.py", line 143, in LoadSettingsFile data = load(stream, Loader=Loader) File "/var/containers/Bundle/Application/42AA46AA-4145-4FC9-8A31-7063E5F0ADE2/Pythonista3.app/Frameworks/Py3Kit.framework/pylib/site-packages/yaml/__init__.py", line 73, in load return loader.get_single_data() File "/var/containers/Bundle/Application/42AA46AA-4145-4FC9-8A31-7063E5F0ADE2/Pythonista3.app/Frameworks/Py3Kit.framework/pylib/site-packages/yaml/constructor.py", line 38, in get_single_data return self.construct_document(node) File "/var/containers/Bundle/Application/42AA46AA-4145-4FC9-8A31-7063E5F0ADE2/Pythonista3.app/Frameworks/Py3Kit.framework/pylib/site-packages/yaml/constructor.py", line 47, in construct_document for dummy in generator: File "/var/containers/Bundle/Application/42AA46AA-4145-4FC9-8A31-7063E5F0ADE2/Pythonista3.app/Frameworks/Py3Kit.framework/pylib/site-packages/yaml/constructor.py", line 399, in construct_yaml_map value = self.construct_mapping(node) File "/var/containers/Bundle/Application/42AA46AA-4145-4FC9-8A31-7063E5F0ADE2/Pythonista3.app/Frameworks/Py3Kit.framework/pylib/site-packages/yaml/constructor.py", line 205, in construct_mapping return super().construct_mapping(node, deep=deep) File "/var/containers/Bundle/Application/42AA46AA-4145-4FC9-8A31-7063E5F0ADE2/Pythonista3.app/Frameworks/Py3Kit.framework/pylib/site-packages/yaml/constructor.py", line 127, in construct_mapping if not isinstance(key, collections.Hashable): AttributeError: module 'collections' has no attribute 'Hashable'
-
Yet another thing that was migrated from
collections
tocollections.abc
. -
@ccc I know but I can't change Pythonista code it-self thus I hope a kind of swizzle.
-
%
python3.10
>>> import collections >>> setattr(collections, "Hashable", collections.abc.Hashable) >>> collections.Hashable <class 'collections.abc.Hashable'>
Try that before importing Google Drive.
-
@ccc Thanks. It seems to work, my program crashes further, then I've still to search...
I add you in my guru's list (note that you were already first in the list for Python 😉 but I didn't even know that Python allows such bypass). -
-
We do not even need
setattr()
...>>> import collections >>>> collections.Hashable = collections.abc.Hashable >>>> collections.MutableMapping = collections.abc.MutableMapping >>>> collections.Hashable, collections.MutableMapping >(<class 'collections.abc.Hashable'>, <class 'collections.abc.MutableMapping'>)