Open nerdneilsfield opened 1 year ago
This issue is the same as #125 Looking into it.
Thanks
Hey @afwolfe, do you know a solution to this? I've not encountered it on my side but several users are complaining. Linked a commit I made to kind of refactor it.
@nerdneilsfield Can you check if this build works? Just replace the executable with the one in the Bash Launcher folder.
Hey @redromnon. It took some digging and trial and error but I think I was able to figure it out.
In order to debug with VS Code, I had to do the following to get HeroicBashLauncher to work without being bundled up by PyInstaller and being in the Games/Heroic/HeroicBashLauncher directory (please let me know if there's a better way to do this):
func
imports while it was in the same directory.)${REPLACE_WITH_PATH_TO_HOME}
)
{
"version": "0.2.0",
"configurations": [
{
"name": "HeroicBashLauncher",
"type": "python",
"request": "launch",
"program": "${workspaceFolder}/HeroicBashLauncher.py",
"cwd": "${REPLACE_WITH_PATH_TO_HOME}/Games/Heroic/HeroicBashLauncher/",
"console": "integratedTerminal",
"justMyCode": true
}
]
}
args
is None
when imported. On the fix-args-parser
branch args
is a Namespace
, but it looks like args.silent
is still unset and will throw the AttributeError: 'Namespace' object has no attribute 'silent'
.After a bit more searching, I think this StackOverflow does a good job explaining the bug which seems to relate to the visibility of global variables in imported modules: https://stackoverflow.com/questions/15959534/visibility-of-global-variables-in-imported-modules Especially this in the top answer from abarnert:
Don't use a
from
import unless the variable is intended to be a constant.from shared_stuff import a
would create a new a variable initialized to whatevershared_stuff.a
referred to at the time of the import, and this newa
variable would not be affected by assignments toshared_stuff.a
.
TL;DR: I think one solution could be to change createlaunchfile.py and anywhere else that's using from func.settings import args
to from func import settings
and changing any references from args
to settings.args
should resolve it and use the module's instance of the variable (with the parsed arguments) as we'd expect.
Thanks a ton @afwolfe Will look at the probable solution for this. Did you also find out why this issue doesn't affect all users?
This also explains why the bug doesn't pop in HeroicBashLauncher.py
and listinstalled.py
as from func import settings
is being used.
No problem. It looks like around line 17 should be the timestamp.json not found. Looks like you haven't launched any game from Heroic at all. Please consider doing so."
error. While it's not a great experience that users don't reach the Zenity dialog due to the bug, the HeroicBashLauncher.log should've contained it. Should the issue template be more explicit about requesting the log file? (I saw that it's mentioned in the linked section of the README.)
HeroicBashLauncher must have contained it under HeroicBashLauncher.log
. I'll make it a must to add the log file too.
Made the changes and hopefully, it works fine. This is the updated build.
Describe the bug
can not run the HeroicBash Luancher,
AttributeError: 'Namespace' object has no attribute 'silent'
Expected behavior
the script should run and add the games to Steam Library
Screenshots
log
Details
Additional context None