dennisvang / tufup-example

Example of a self-updating application using tufup.
MIT License
13 stars 8 forks source link

'>' not supported between instances of 'NoneType' and 'NoneType' #18

Closed ginsm closed 11 months ago

ginsm commented 11 months ago

I'm having an issue when client.py tries to compare target_meta.version and self.current_archive.version (here). I'm pretty lost as I am setting the version as far as I'm aware? I largely used this repo and these examples to try and figure everything out.

Here are the files pertaining to the repository side: Repo Settings Repo Init Repo Add bundle

And here are the files pertaining to the client side: Client Settings Client Init

And here are the steps I'm taking:

  1. Initialize the repo.
  2. Build the app (ensuring only one bundle is in the dist dir).
  3. Add the bundle to the repo.
  4. Start the server.
  5. Start the app.

Here's some logs that might help:

Full Error ``` Trusted root metadata copied to cache. Traceback (most recent call last): File "F:\Projects\Active\nazarick-launcher\src\app.py", line 83, in main() File "F:\Projects\Active\nazarick-launcher\src\app.py", line 19, in main tufupClient() File "F:\Projects\Active\nazarick-launcher\src\app.py", line 78, in tufupClient if client.check_for_updates(): ^^^^^^^^^^^^^^^^^^^^^^^^^^ File "%UserProfile%\AppData\Roaming\Python\Python312\site-packages\tufup\client.py", line 163, in check_for_updates all_new_targets = dict( ^^^^^ File "%UserProfile%\AppData\Roaming\Python\Python312\site-packages\tufup\client.py", line 167, in and target_meta.version > self.current_archive.version ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ TypeError: '>' not supported between instances of 'NoneType' and 'NoneType' ```
HTTP Server Log ``` F:\Projects\Active\nazarick-launcher>python -m http.server -d pyinstaller/temp/repository Serving HTTP on :: port 8000 (http://[::]:8000/) ... ::1 - - [22/Oct/2023 06:51:53] code 404, message File not found ::1 - - [22/Oct/2023 06:51:53] "GET /metadata/2.root.json HTTP/1.1" 404 - ::1 - - [22/Oct/2023 06:51:53] "GET /metadata/timestamp.json HTTP/1.1" 200 - ::1 - - [22/Oct/2023 06:51:53] "GET /metadata/snapshot.json HTTP/1.1" 200 - ::1 - - [22/Oct/2023 06:51:54] "GET /metadata/targets.json HTTP/1.1" 200 - ```

It appears to be trying to find 2.root.json which doesn't exist? This occurs when I run either the bundled app or dev app. Any help would be greatly appreciated, thanks! :)

dennisvang commented 11 months ago

@ginsm Thanks for taking an interest in tufup. Could you please edit your question to include the full error and server log as text, instead of linking to pastebin?

dennisvang commented 11 months ago

... it appears to be trying to find 2.root.json which doesn't exist?

python-tuf always tries to download a new version of root.json. That's normal. See TUF client workflow.

dennisvang commented 11 months ago

@ginsm This is probably caused by the whitespace in your APP_NAME.

Here's how tufup parses the version from the filename:

r'^(?P<name>[\w-]+)-(?P<version>.+)(?P<suffix>\.tar\.gz|\.patch)$'
ginsm commented 11 months ago

@ginsm Thanks for taking an interest in tufup. Could you please edit your question to include the full error and server log as text, instead of linking to pastebin?

... it appears to be trying to find 2.root.json which doesn't exist?

python-tuf always tries to download a new version of root.json. That's normal. See TUF client workflow.

Done and thanks for the info!

@ginsm This is probably caused by the whitespace in your APP_NAME.

Here's how tufup parses the version from the filename:

r'^(?P<name>[\w-]+)-(?P<version>.+)(?P<suffix>\.tar\.gz|\.patch)$'

Yup, that seems to have resolved the issue. Thanks for the quick response! :grin: