Forum Archive

Error after installation of pyicloud.py

cvp

To access my iCloud photos, I've installed pyicloud.py and some required modules (tzlocal and future) all via stash pip install module.
The very little test I did seems to be ok but after that, restart of Phythonista gives an errror (see below) and my old scripts do more run with this message "This package should be accessible on Python3"

Traceback (most recent call last):
  File "/var/containers/Bundle/Application/606A7B2D-313E-48DB-BEB5-79336C85A91D/Pythonista3.app/Frameworks/PythonistaKit3.framework/pythonista3_startup.py", line 46, in <module>
    import importcompletion
  File "/var/containers/Bundle/Application/606A7B2D-313E-48DB-BEB5-79336C85A91D/Pythonista3.app/Frameworks/PythonistaKit3.framework/pylib/importcompletion.py", line 25, in <module>
    import imp
  File "/var/containers/Bundle/Application/606A7B2D-313E-48DB-BEB5-79336C85A91D/Pythonista3.app/Frameworks/PythonistaKit3.framework/pylib/imp.py", line 20, in <module>
    from importlib._bootstrap import _ERR_MSG, _exec, _load, _builtin_from_name
  File "/var/containers/Bundle/Application/606A7B2D-313E-48DB-BEB5-79336C85A91D/Pythonista3.app/Frameworks/PythonistaKit3.framework/pylib/importlib/__init__.py", line 58, in <module>
    import types
  File "/var/containers/Bundle/Application/606A7B2D-313E-48DB-BEB5-79336C85A91D/Pythonista3.app/Frameworks/PythonistaKit3.framework/pylib/types.py", line 167, in <module>
    import functools as _functools
  File "/var/containers/Bundle/Application/606A7B2D-313E-48DB-BEB5-79336C85A91D/Pythonista3.app/Frameworks/PythonistaKit3.framework/pylib/functools.py", line 22, in <module>
    from collections import namedtuple
  File "/var/containers/Bundle/Application/606A7B2D-313E-48DB-BEB5-79336C85A91D/Pythonista3.app/Frameworks/PythonistaKit3.framework/pylib/collections/__init__.py", line 16, in <module>
    from reprlib import recursive_repr as _recursive_repr
  File "/private/var/mobile/Containers/Shared/AppGroup/BC53E549-355D-4E77-BC46-64C3D3E0BDAF/Pythonista3/Documents/site-packages/reprlib/__init__.py", line 7, in <module>
    raise ImportError('This package should not be accessible on Python 3. '
ImportError: This package should not be accessible on Python 3. Either you are trying to run from the python-future src folder or your installation of python-future is corrupted.
omz

I can't say much about the error, but wouldn't it perhaps be easier to use the built-in photos module instead?

cvp

Ho no!
In reality, the Photos module access to the photos on my device where Pythonista runs.
My wife has her photos on iCloud, but I didn't set so because I don't want to receive all (thousands 😭) her photos on my devices.
With pyicloud, I can access on my device to her photos, and so I could get a photo and copy it, as backup, on a FTP server...
That, always in my dreamed challenge to replace my iMac/Pc by my iPad.

Anyway, I think the problem comes that an imported module (named future) in pyicloud checks the sys.version_info but even if I rename the future module as anything else, I have the same problem.

omz

Have you tried running this with the 2.7 interpreter?

cvp

Yes, my little test only runs with #!python2.
But the problem is that all my other scripts now have this error...

I don't know why but the installation has also installed 2 modules in sites-packages: reprlib and copyreg which seem to generate these errors. I have renamed both in same name_xxx, fully restarted Pythonista and my little test runs normally in Python2 and all my Python3 scripts seem to be also ok, at least them I've just tested.

cvp

Anyway, I really love your app. I can't imagine my life of retired guy without it...
Thus, be careful and try to continue to support it during a lot of years.
Even if I could buy a new version each year, it's the less expensive hobby I never have had.
One more time, thanks a lot for your marvelous work.

cvp

@omz After some hours of tests, I'm able, via pyicloud, to download photos from iCloud, but the get request only gives 993 photos, even if iCloud contains a lot more, and I don't know why.
Now, I hesitate to use a new ios8 feature of the PhAsset objectiveC allowing to access photos, no more only on the iDevice but also on iCloud Photos Library, but of course, it will be more complicated. I have all needed time to try, but without the needed skills, I agree 😢

Please read this and tell me if it's the case, Thanks.

omz

@cvp Using PHAsset would be pretty much the same as using the photos module (it's basically a wrapper around PHAsset and related ObjC classes). You couldn't access iCloud photos from a different account than the one you're signed in with (in the Photos app) that way.

cvp

I understand but my problem is that my iPad where Pythonista runs is configured to not access to iCloud Photos Library to avoid the automatic download of the thousands of photos taken by my wife on her iPhone (we have the same iCloud account).
And I want to (be able to) get these iCloud photos in my local Pythonista files and to decide my-self if I keep them or if I send them to an FTP NAS.
Thus, either pyicloud allows to get these photos,either PhAsset could perhaps do it with a particular option, and I'm not sure I could set this option with the photos module.
But anyway, if my iCloud setting is set to "photos iCloud Library" to off, I'm not sure that the PhAsset ObjC would be authorized!
Hoping I'm clear enough because iCloud Photos Library is not always obvious., without speaking about Photos stream and Photos sharing...

cvp

I've found on pyicloud topic of GitHub, a comment of somebody who had the same kind of problem with the contacts.py module which always gets maximum 500 contacts...
I'll try to understand his modification and try to transpose it in the photos.py module of pyicloud, but without a great hope for the moment.
But I like this challenge: one more time I'll learn something new because I don't know anything about get/requests etc...Wait and pray

here

cvp

Solved by pyicloud update, see here