Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Script doesn't work when launching memento but works from command line #141

Open
Roxiun opened this issue Dec 30, 2022 · 6 comments
Open
Labels
bug Something isn't working can't fix For some reason or another this issue cannot be fixed macos This only occurs on macOS

Comments

@Roxiun
Copy link

Roxiun commented Dec 30, 2022

Version: v1.0.0
OS: macOS 13.1 (M1 Macbook Air)

When launching memento via the app my script doesn't seem to load for some reason. However, when launching memento from the command line (/Applications/Memento.app/Contents/MacOS/Memento), the script works perfectly and runs.

If it makes any difference its an mp.add_hook('on_load', 50, some_function) lua script

@ripose-jp
Copy link
Owner

I can't reproduce your issue. Make sure that your script is in the scripts folder in the location opened by going to SettingsOpen Config Folder. If that doesn't work, post your script.

@Roxiun
Copy link
Author

Roxiun commented Dec 31, 2022

@ripose-jp Yep it is in the scripts folder.

This is the script I was trying to use:
https://codeberg.org/kochi/zoro-mpv

It worked perfectly when launching memento from the command line but not when opening the app normally

@ripose-jp
Copy link
Owner

It's probably a problem with Python (or the rather the correct Python) not being in the PATH variable when launching Memento like a normal macOS app. I've already dealt with a similar problem in #30, though I didn't find a great way to solve it at the time. I'll look into this to see if I can find any way to fix it, but it's likely something that will need to be fixed in configuration rather than code.

@ripose-jp ripose-jp added bug Something isn't working macos This only occurs on macOS labels Dec 31, 2022
@Roxiun
Copy link
Author

Roxiun commented Dec 31, 2022

It's probably a problem with Python (or the rather the correct Python) not being in the PATH variable when launching Memento like a normal macOS app.

Also as a side-note which may be related is that my youtube-dl doesn't seem to currently be working when launching the app but works from command line.

I think i may have something to do with the fact I installed yt-dlp through pipx?

@ripose-jp
Copy link
Owner

The reasons are all in #30. I make sure to put a link to the fix in each release at the bottom.

https://github.com/ripose-jp/Memento#macos-streaming-video-doesnt-work

@ripose-jp
Copy link
Owner

I was looking into the problem and I'm getting a lot of indications that this may not be easily fixable. This StackExchange post seems to indicate it's possible to inject things into your PATH variable, but that's something left up to the user.

The difficulty with this issue is that macOS package managers generally all install things to different areas and just append a PATH export to your .bash_profile or .zshrc file. There's very little consistency and when launching app bundles, all those are simply ignored. There are various ways macOS applications handle accessing executables not in the default app bundle PATH. For example IINA has the user manually specify the location of the youtube-dl executable in its settings. Memento takes a similar approach in that app bundle version hard codes the path to youtube-dl to be in Memento's config folder unless it's set to be somewhere else in your mpv.conf.

I think the best way to fix this is by editing the code of your plugin's main.lua to hard code the locations of python3 and pyenv binaries and then invoke them like /usr/local/bin/python3. This way the PATH variable isn't relevant.

For these reasons I'm going to mark this as a can't fix.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working can't fix For some reason or another this issue cannot be fixed macos This only occurs on macOS
Projects
None yet
Development

No branches or pull requests

2 participants