Python error - No Games shown in library

No matter which game I am installing, it never shows up in my library.

I can see python errors in the debug output, they look like this:

File “/usr/lib/python3/dist-packages/lutris/util/strings.py”, line 124, in get_formatted_playtime
hours = math.floor(playtime)
TypeError: must be real number, not str

complete output, with issue-report info is here:

Thanks for helping

Alberto

Odd. store_item.py has verification around putting “bad” values into the games DB, and string.py has code preventing returning bad numbers.

If you open your pga.db with sqlite3 and just dump out the game name and playtime, does it have any weird (i.e. non-float) data?
The trailing data should all be empty or floats. Here’s mine, for example.

cuteroot@pinhead $ sqlite3 /home/cuteroot/.local/share/lutris/pga.db

sqlite> select NAME,playtime from games where playtime NOT like “”;
The Elder Scrolls II: Daggerfall|0.734444444444445
Fallout 2|34.9147222222223
XIII|1.38361111111111
Fallout|2.91027777777778
GOG Galaxy|0.860277777777778
Seven: The Days Long Gone|0.120277777777778
Blizzard Battle.net|3.28444444444444
Druidstone|0.455
Stories: The Path of Destinies|2.76638888888889
Invisible, Inc.|0.0

What you could also do is edit strings.py and add
logger.warning(playtime)
before line 124 (python expects similar indentation - would use spaces)

This gives me the following when I start up - the warning lines are basically my playtimes, unformatted.

WARNING 2020-12-06 13:23:55,615 [strings.get_formatted_playtime:123]:2.910277777777778
WARNING 2020-12-06 13:23:55,615 [strings.get_formatted_playtime:123]:34.91472222222229
WARNING 2020-12-06 13:23:55,616 [strings.get_formatted_playtime:123]:0.04111111111111111
WARNING 2020-12-06 13:23:55,617 [strings.get_formatted_playtime:123]:2.766388888888889
DEBUG 2020-12-06 13:23:55,621 [http.get:73]:GET https://lutris.net/api/runtimes
DEBUG 2020-12-06 13:23:55,759 [http.get:73]:GET https://lutris.net/api/runtimes/icons
WARNING 2020-12-06 13:23:57,208 [strings.get_formatted_playtime:124]:2.910277777777778
WARNING 2020-12-06 13:23:57,209 [strings.get_formatted_playtime:124]:34.91472222222229
WARNING 2020-12-06 13:23:57,209 [strings.get_formatted_playtime:124]:0.04111111111111111
WARNING 2020-12-06 13:23:57,209 [strings.get_formatted_playtime:124]:2.766388888888889

If it’s a bad DB entry, then just export it, delete it and re-run lutris.

Or, you can move pga.db and start again, but that’s a pain :slight_smile:

Edit: Beware the mangled double-quotes in the SQL statement above when using blockquote!

Hi,

Shortly after posting about my issue I decided to delete my pga.db and start from scratch.

That fixed the problem (I have to reinstall games though…)

Unfortunately I am no longer able to reproduce the issue, so further debugging is not possible anymore.

Thanks for answering anyway, I appreciate your support.

Alberto

I had the same problem, so followed the steps to add
logger.warning("playtime " + playtime)

The result was:

2020-12-18 23:35:49,906: playtime 0.0
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/lutris/gui/lutriswindow.py", line 441, in update_store
    self.game_store.add_game(game)
  File "/usr/lib/python3/dist-packages/lutris/gui/views/store.py", line 173, in add_game
    game.playtime_text,
  File "/usr/lib/python3/dist-packages/lutris/gui/views/store_item.py", line 142, in playtime_text
    _playtime_text = get_formatted_playtime(self.playtime)
  File "/usr/lib/python3/dist-packages/lutris/util/strings.py", line 125, in get_formatted_playtime
    hours = math.floor(playtime)
TypeError: must be real number, not str

I upgraded ubuntu from 19.04 to 20.04

My problem was that my pga.db must be old. The playtime column was a string. I change the type of the column to REAL and my library loads again.

Good find. :+1: I must have avoided this as I wiped and created a fresh profile last time I did an OS upgrade. Probably doesn’t happen very much anymore, but would be worth a line of Python to check.

thanks!! same upgrade, 19>20, same err, same fix - switched to REAL… it can count again.
feels like this should have been handled smoother but lutris is still amazing regardless