mazurwiktor / albion-online-stats

Albion online stats is an extension to MMORPG game - Albion Online. It tracks network traffic and displays various statistics, such as damage and DPS meter calculated from in-game actions.
Apache License 2.0
194 stars 62 forks source link

[BUG] Version 0.11.6 crashes when installed for all users #41

Closed jgentil closed 3 years ago

jgentil commented 4 years ago

Describe the bug Install with "Install for all users" option. Run the program. Program does not start. It looks like it tries to create it's config file at the same location of the executable, which you can't do if it's installed in \Program Files. It should be in %APPDATA%

Log file damage-meter.log created in the same directory as executable. It didn't create a damage-meter.log file, but I've been programming Python for a long time, so I ran it manually:

Microsoft Windows [Version 10.0.18363.836]
(c) 2019 Microsoft Corporation. All rights reserved.

C:\Users\zen>"C:\Program Files\Albion Online Stats\Python\python.exe" "C:\Program Files\Albion Online Stats\Albion_Online_Stats.launch.pyw"
Traceback (most recent call last):
  File "C:\Program Files\Albion Online Stats\pkgs\src\utils\config.py", line 44, in config
    with open(conf_file, "r") as cfg_file:
FileNotFoundError: [Errno 2] No such file or directory: 'C:\\Program Files\\Albion Online Stats\\albion-online-stats.cfg'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Program Files\Albion Online Stats\Albion_Online_Stats.launch.pyw", line 34, in <module>
    from src import run
  File "C:\Program Files\Albion Online Stats\pkgs\src\__init__.py", line 3, in <module>
    from .gui.app import run
  File "C:\Program Files\Albion Online Stats\pkgs\src\gui\app.py", line 18, in <module>
    from .styling import style
  File "C:\Program Files\Albion Online Stats\pkgs\src\gui\styling.py", line 3, in <module>
    cfg = config()
  File "C:\Program Files\Albion Online Stats\pkgs\src\utils\config.py", line 50, in config
    with open(conf_file, "w") as cfg_file:
PermissionError: [Errno 13] Permission denied: 'C:\\Program Files\\Albion Online Stats\\albion-online-stats.cfg'
jgentil commented 4 years ago

I notice in Albion_Online_Stats.launch.pyw you account for this by making an appdata variable and putting the logs there, but in src.utils.config you use sys.argv[0] which should probably be used after trying appdata. :)

jgentil commented 4 years ago

And I just confirmed that works. :)

mazurwiktor commented 4 years ago

Sounds reasonable. Could you create PR?

mazurwiktor commented 3 years ago

Fixed in 0.11.11