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

TypeError: expected str, bytes or os.PathLike object, not NoneType #18

Closed
eleaner opened this issue Aug 2, 2020 · 5 comments
Closed

Comments

@eleaner
Copy link

eleaner commented Aug 2, 2020

Hi, when authenticating I am getting this weird error
please help


Traceback (most recent call last):
  File "/usr/bin/icloudpd", line 11, in <module>
    load_entry_point('icloudpd==1.5.0', 'console_scripts', 'icloudpd')()
  File "/usr/lib/python3.8/site-packages/click-6.7-py3.8.egg/click/core.py", line 722, in __call__
    return self.main(*args, **kwargs)
  File "/usr/lib/python3.8/site-packages/click-6.7-py3.8.egg/click/core.py", line 697, in main
    rv = self.invoke(ctx)
  File "/usr/lib/python3.8/site-packages/click-6.7-py3.8.egg/click/core.py", line 895, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/usr/lib/python3.8/site-packages/click-6.7-py3.8.egg/click/core.py", line 535, in invoke
    return callback(*args, **kwargs)
  File "/usr/lib/python3.8/site-packages/icloudpd-1.5.0-py3.8.egg/icloudpd/base.py", line 292, in main
  File "/usr/lib/python3.8/posixpath.py", line 336, in normpath
    path = os.fspath(path)
TypeError: expected str, bytes or os.PathLike object, not NoneType
2020-08-02 12:55:25 INFO     Please ignore the 'expected str, bytes or os.PathLike object, not NoneType' error. This is a fault with the underlying application Python application
@eleaner eleaner changed the title ypeError: expected str, bytes or os.PathLike object, not NoneType TypeError: expected str, bytes or os.PathLike object, not NoneType Aug 2, 2020
@boredazfcuk
Copy link
Owner

boredazfcuk commented Aug 2, 2020

Hi,

That error is to be expected. The Python application which runs inside my container is generating the error. I'm not sure why it generates this error as I'm not a Python expert, but it doesn't seem to affect anything. That's why I add the:

INFO     Please ignore the 'expected str, bytes or os.PathLike object, not NoneType' error.

line to the log file.

Is it not downloading the photos in your photo stream?

@boredazfcuk
Copy link
Owner

boredazfcuk commented Aug 2, 2020

Actually,..

I've just worked out why this issue is happening and amended the code to fix it.

New code has been built on Dockerhub and I've pushed new ARM32/ARM64 images too.

If the problems remains, just update this issue and I'll take another look at it.

@eleaner
Copy link
Author

eleaner commented Aug 2, 2020

thank you

@AndreyNikiforov
Copy link

I've just worked out why this issue is happening and amended the code to fix it.

@boredazfcuk What was the problem and how it was fixed?

Same issue reported icloud-photos-downloader/icloud_photos_downloader#175

@boredazfcuk
Copy link
Owner

The issue was due to me not specifying the --directory command, as I didn't know it was mandatory.

I created a function that had the sole purpose of generating a 2FA cookie (not performing the download) and the command that generated the cookie was basically:

/usr/bin/icloudpd --username "${0}" --password "${1}" --cookie-directory "${2}"

I expected this to generate the cookie and then exit. It partially worked, as it would create the cookie after completing the 2FA process, but then it would throw the error.

The next step was to generate my cookie like this:

/usr/bin/icloudpd --username "${0}" --password "${1}" --cookie-directory "${2}" --directory "/tmp/test" --only-print-filenames'

However, I found that icloudpd would actually create the full directory structure for my Photo Stream in /tmp/test... So like

/tmp/test
   |-2020
   |      |- 10
   |           |- 01
   |           |- 02
   |
   |- 2019

Which wasn't what I wanted.

The command then evolved into:

/usr/bin/icloudpd --username "${0}" --password "${1}" --cookie-directory "${2}" --directory "/dev/null" --only-print-filenames'

So that the empty file structure would just get thrown into the bit bucket.

The final version I settled on was actually this (I'm surprised it worked to be honest):

/usr/bin/icloudpd --username "${0}" --password "${1}" --cookie-directory "${2}" --directory "/dev/null" --only-print-filenames --recent 0'

Adding the --recent 0 to the end sped it up a little, because it returned empty results each time anyway.

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

No branches or pull requests

3 participants