SteamDeckHomebrew / decky-loader

A plugin loader for the Steam Deck.
https://decky.xyz
GNU General Public License v2.0
4.72k stars 164 forks source link

[BUG] decky_loader not found when running from vscode "deployandrun" task #392

Closed geeksville closed 1 year ago

geeksville commented 1 year ago

Please confirm

Bug Report Description

I just tried building and installing decky-loader myself for the first time (so I could add some debugging code). I used the vscode "allinone" task and it builds/installs/seems to run.

But when I go install from the store I see:

[plugin][ERROR]: Failed to start Steamback!
Traceback (most recent call last):
  File "/home/deck/homebrew/dev/pluginloader/backend/plugin.py", line 89, in _init
    spec.loader.exec_module(module)
  File "<frozen importlib._bootstrap_external>", line 883, in exec_module
  File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
  File "/home/deck/homebrew/dev/plugins/Steamback/main.py", line 14, in <module>
    import decky_plugin
ModuleNotFoundError: No module named 'decky_plugin'

The problem is that the plugin directory isn't being set correctly in plugin.py. The code there says:

            # append the loader's plugin path to the recognized python paths
            syspath.append(path.realpath(path.join(path.dirname(__file__), "plugin")))

BUT plugin/decky_plugin is in /home/deck/homebrew/dev/pluginloader not
/home/deck/homebrew/dev/pluginloader/backend

So my nasty hack is to stick in a .. after the backend directoy and we then the loader gets launched with the correct options to let it find decky_loader in the python path.

            # append the loader's plugin path to the recognized python paths
            syspath.append(path.realpath(path.join(path.dirname(__file__), "..", "plugin")))

Though clearly I'd expect this is not a good fix because I assume it would then have the wrong path for production. @TrainDoctor Any advice? If not I'll look for a clean fix.

Expected Behaviour

decky_loader should be found in the python path.

SteamOS version

3.4.4 stable

Selected Update Channel

Stable

Have you modified the read-only filesystem at any point?

No response

Logs

debug log attached above (since I was running in dev mode the log output only comes in vscode)

geeksville commented 1 year ago

note: I'm talking about the vscode deployment of the python dev version of the code (which gets copied by the vscode runpydeck task:

"command": "ssh deck@${config:deckip} -p ${config:deckport} ${config:deckkey} 'export PLUGIN_PATH=${config:deckdir}/homebrew/dev/plugins; export CHOWN_PLUGIN_PATH=0; export LOG_LEVEL=DEBUG; cd ${config:deckdir}/homebrew/services; echo '${config:deckpass}' | sudo -SE python3 ${config:deckdir}/homebrew/dev/pluginloader/backend/main.py'",

In that case it is running straight .py files that were sshed over by the developer. and the directory is .../homebrew/dev....