a1ex4 / ownfoil

Lightweight and customizable Tinfoil Shop manager, with automatic saves backup.
BSD 3-Clause "New" or "Revised" License
311 stars 32 forks source link

v2 Error: ValueError: invalid literal for int() with base 10: '' #83

Closed rafamdf closed 1 month ago

rafamdf commented 2 months ago

I already used v1 for some time, and tried v2 today.

Ran into this error on initial deploy. (Great work, btw).

File "/usr/local/lib/python3.11/site-packages/flask/app.py", line 1478, in call return self.wsgi_app(environ, start_response) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/flask/app.py", line 1458, in wsgi_app response = self.handle_exception(e) ^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/flask/app.py", line 1455, in wsgi_app response = self.full_dispatch_request() ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/flask/app.py", line 869, in full_dispatch_request rv = self.handle_user_exception(e) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/flask/app.py", line 867, in full_dispatch_request rv = self.dispatch_request() ^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/flask/app.py", line 852, in dispatch_request return self.ensure_sync(self.view_functions[rule.endpoint])(view_args) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/app/app.py", line 77, in index return access_shop_auth() ^^^^^^^^^^^^^^^^^^ File "/app/auth.py", line 26, in decorated_view return f(*args, *kwargs) ^^^^^^^^^^^^^^^^^^ File "/app/app.py", line 64, in access_shop_auth return access_shop() ^^^^^^^^^^^^^ File "/app/app.py", line 60, in access_shop return render_template('index.html', title='Library', games=get_all_titles(), admin_account_created=admin_account_created(), valid_keys=app_settings['valid_keys']) ^^^^^^^^^^^^^^^^ File "/app/auth.py", line 26, in decorated_view return f(args, kwargs) ^^^^^^^^^^^^^^^^^^ File "/app/app.py", line 173, in get_all_titles if title['version'] == int(app_id_version_from_versions_txt): ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ValueError: invalid literal for int() with base 10: ''

Sev7nrayne commented 1 month ago

@a1ex4 something changed with tag: V2 now getting a error:

image

PortableProgrammer commented 1 month ago

I had OP's issue and traced it back to an invalid line in /app/data/titledb/versions.txt, which is generated from blawar's titledb repo.

From within the docker container, I pulled app_id from each file and compared it to versions.txt and found the bad line:

for NSP in /games/*.nsp;
    do APPID=`echo $NSP | sed -r 's/.*\[([0-9a-fA-F]{16})\].*\.nsp/\1/'`;
    egrep “^$APPID” /app/data/titledb/versions.txt;
done

0100800015927001|00000000000000000000000000000000|

As a quick fix, I manually edited versions.txt to add the correct version number (0 in this case): 0100800015927001|00000000000000000000000000000000|0

Looks like the check here doesn't catch this instance (it seems to be an empty string, '', not None) https://github.com/a1ex4/ownfoil/blob/370e33c510d85b443e4390752da2c5bc44160e43/app/app.py#L176-L178

a1ex4 commented 1 month ago

@rafamdf @PortableProgrammer thanks for reporting this issue and for your investigation, I was able to reproduce and fix, it should now be working with latest commit.

@Sev7nrayne yes there were some changes with the database, just remove your ownfoil.db and it will generate a working one.