Skip to content

NameError: name 'PyiCloudConnectionException' is not defined. Did you mean: 'PyiCloudFailedLoginException'? #836

@boredazfcuk

Description

@boredazfcuk

Overview

In the past few weeks I've had a few users report the following error:

NameError: name 'PyiCloudConnectionException' is not defined. Did you mean: 'PyiCloudFailedLoginException'?

Steps to Reproduce

They seem to report this when initialising their container/saving their password.

Expected Behavior

For this crash not to occur

Actual Behavior

Error crashes application before downloads begin.

Context

After looking at the code in base.py, it seems to be attempting to call an exception related to an incorrectly configured domain parameter:

        # {'domainToUse': 'iCloud.com'}
        domain_to_use = self.data.get('domainToUse')
        if domain_to_use != None:
            msg = f'Apple insists on using {domain_to_use} for your request. Please use --domain parameter'
            raise PyiCloudConnectionException(msg)

The error suggests that this exception does not exist:

File "starters/icloud.py", line 5, in
File "pyicloud_ipd/cmdline.py", line 200, in main
File "pyicloud_ipd/base.py", line 305, in init
File "pyicloud_ipd/base.py", line 367, in authenticate
File "pyicloud_ipd/base.py", line 399, in _authenticate_with_token
NameError: name 'PyiCloudConnectionException' is not defined. Did you mean: 'PyiCloudFailedLoginException'?
[424] Failed to execute script 'icloud' due to unhandled exception!

However I did find it in exceptions.py:

# Potentially Deprecated - Further review needed
class PyiCloudConnectionException(PyiCloudException):
    pass

Once upon a time, if a user attempted to connect to the authentication servers in China, but had not specified the --domain parameter, they would receive the Apple insists on using {domain_to_use} for your request. Please use --domain parameter' error message. I think that this isn't happening any more, for some reason.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions