Digital-Sapphire / PyUpdater

Pyinstaller auto-update library
https://www.pyupdater.org
460 stars 92 forks source link

AttributeError: 'NoneType' object has no attribute 'keys' #307

Closed Mezo1234-beep closed 3 years ago

Mezo1234-beep commented 3 years ago

I have the following error caused when am running my app.

Traceback (most recent call last):
  File "C:/Users/user-anem/Desktop/New/my-project/scripts/main.py", line 114, in <module>
    CheckForUpdates(main_window)
  File "C:/Users/user-anem/Desktop/New/my-project/scripts/main.py", line 97, in CheckForUpdates
    raise (e)
  File "C:/Users/user-anem/Desktop/New/my-project/scripts/main.py", line 72, in CheckForUpdates
    client.refresh()
  File "C:\Users\user-anem\Desktop\my-project\venv\lib\site-packages\pyupdater\client\__init__.py", line 218, in refresh
    self._get_update_manifest()
  File "C:\Users\user-anem\Desktop\my-project\venv\lib\site-packages\pyupdater\client\__init__.py", line 540, in _get_update_manifest
    self._verify_sig(self.json_data)
  File "C:\Users\user-anem\Desktop\my-project\venv\lib\site-packages\pyupdater\client\__init__.py", line 551, in _verify_sig
    if "signature" in data.keys():
AttributeError: 'NoneType' object has no attribute 'keys'

Process finished with exit code 1

And here is my code:

def CheckForUpdates(window):
    """
    Check for updates.
    Channel options are stable, beta & alpha
    Patches are only created & applied on the stable channel
    """
    print("Checking for updates...")
    client_config = ClientConfig()

    # refresh to get the online manifest for version checking

    try:
        client = Client(ClientConfig())
        client.refresh()
        app_update = client.update_check(client_config.APP_NAME, APP_VERSION)
        if app_update:
            # downloaded = app_update.download()
            answer = download_update_dialog(window, "Download the updates?")
            # if downloaded:
            #     print("Installing....")
            #     app_update.extract_restart()
            if answer == QMessageBox.Yes:
                if hasattr(sys, "frozen"):
                    if app_update.is_downloaded():
                        app_update.extract_restart()
                    else:
                        print("Downloading....")
                        downloaded = app_update.download()
                        if downloaded:
                            print("Installing....")
                            app_update.extract_restart()
                        else:
                            print('Update download failed.')
                else:
                    print('Update available but application is not frozen.')
        else:
            answer = download_update_dialog(window, "Sorry but there is no update.")
    except Exception as e:
        raise (e)
        # pri/nt(download_update_dialog(window, str(e)))

I have created the keys correctly and imported them to the init and after am importing the deploy folder to my localhost it caused this problem.

last two days I was working on a small project real small and all was fine, but now after I moved into the big project I had this weird problem and I did the same steps as before.

Python: 3.7.6 PyInstaller: 4.4 PyUpdater: 4.0

Mezo1234-beep commented 3 years ago

@JMSwag Please can you help me with this issue? Here is the code structure: |-- project-folder _|-------- _clientconfig.py _____|-------- win.spec _|-------- bin |-------- .pyupdater |-------- pyu-data _|-------- data (where we store images... etc) ___|-------- folder-A (store images... etc) |-------- folder-B (store images... etc) |-------- folder-C (store images... etc) _|-------- Scripts (Where we have the python scripts) ___ |-------- main.py |-------- folder-A (store .py modules) |-------- folder-B (store .py modules) ___|-------- folder-C (store .py modules)

What I did is:

  1. Created the keys in project-folder and named it (i.e testApp)
  2. Init the PyUpdater and enter the info (i.e: testApp, companyName, HTTP://localhost:8080/, No backup, Yes Patches, and use the current directory which is project-folder).
  3. then I made the build and pkg -p -s
  4. and BEFORE I deeply the deploy folder to the local host there is no error BUT after that, I got the above error which is there is no attribute keys.

So where I do wrong? how to fix it I really get stuck with this and I don't know the source of the problem