Open sarcman opened 1 year ago
That's odd indeed! There's a few internal mechanisms that rely on calls to Platform.userExtensionDir to get and set key file paths. Just to check before we move on -- do you really have a user account and corresponding directory called 'name'? As that's what is being returned by the call to Platform.userExtensionDir.
Hi ! no, I simply replaced my "account-name" with "name" in a text editor for simplicity
Btw, Lilypond seems to work fine on its own via the terminal
I'm not sure that I understand what you're doing. The error dump in your first message shows that FoscIOManager is looking for files in "/Users/name/...", which obviously don't exist. If you're editing the filepaths independently then you're likely to break dependencies that are generated internally.
Where have you placed the 'fosc' directory? Is it in the same location that SC returns when you call Platform.userExtensionDir?
Forgive me if I haven't made it clear.
FoscIOManager is looking for a pdf file to open which should live in: "/Users/name/Library/Application Support/SuperCollider/fosc-output/"
The lilypond file (0001.ly) gets created within the fosc-output folder without an issue it seems, however the pdf file isn't created, hence FoscIOManager complains that it has nothing to open
The fosc folder lives inside the Extensions foler: /Users/name/Library/Application Support/SuperCollider/Extensions
Yes, I can see that much. What I'm trying to understand is your comment from a couple of post's back which suggested that you had edited some of the file paths. Or is it the case that you've only edited them for what you're posting here, and that the file path is correct (i.e. something different to '/Users/name') in all of the error dumps and the \include section of the ly file?
The other possibility -- assuming that the filepaths are not being changed -- is that Fosc.lilypondPath hasn't been set correctly. This would mean that the PDF never gets generated from the LY file. Could you run the following snippet and send back the post output?:
FoscIOManager.runLilypond("%/0001.ly".format(Fosc.outputDirectory));
I see. The file paths are correct.
The latest code snippet returns -> false
OK, we've found the issue! If you look in the 'Configure Fosc' subsection in the 'Installation' part of the README, you'll see a bit on setting Fosc.lilypondPath in your SC startup file. This is the only bit of manual configuration that you need to do, but it has to be done properly for Fosc to be able to compile lilypond files. The key thing is that the path is set to the lilypond executable that you're using. If you're not sure where it is, you should be able to locate it by running this in a terminal: which lilypond
Fosc.lilypondPath = "/opt/local/bin/lilypond";
This path has been set in the startup.scd file, and Fosc seems happy to call LilyPond, as Fosc.lilypondVersion;
returns -> 2.24.1
Great. That means that your example from the start of the thread should work now.
Well, the path had been set from the start ! But it throws the error even though Fosc is able to call LilyPond. The pdf file cannot be created for some reason.
Hmm, that's odd. What happens when you call: Fosc.lilypondPath
-> /opt/local/bin/lilypond
And what happens when you run the following from a terminal (with the correct user path substituted):
/opt/local/bin/lilypond "/Users/name/Library/Application Support/SuperCollider/fosc-output/0001.pdf"
Sorry, that should have been:
/opt/local/bin/lilypond "/Users/name/Library/Application Support/SuperCollider/fosc-output/0001.ly"
Processing `/Users/name/Library/Application Support/SuperCollider/fosc-output/0001.ly'
Parsing...
Interpreting music...
Preprocessing graphical objects...
Finding the ideal number of pages...
Fitting music on 1 page...
Drawing systems...
Converting to `0001.pdf'...
Success: compilation successfully completed```
***************
and it creates a pdf file in "/Users/name/0001.pdf"
OK. Just one more bit of code to try, this time from SuperCollider. This should be identical to what's called by FoscIOManager.runLilypond. Again, it'd be useful to see the full post output.
systemCmd("/opt/local/bin/lilypond -dno-point-and-click -o '/Users/name/Library/Application Support/SuperCollider/fosc-output/0001' '/Users/name/Library/Application Support/SuperCollider/fosc-output/0001.ly'");
-> 256
Is that the full output? Is there not a bunch of other text before the error code, e.g. "Changing working directory to: `/Users/name/Library/Application Support/... " etc. etc.?
nope, nothing, just this.
Hmm, OK. I get the full transcript from systemCmd posted back to the SC Post window.
This is eluding me now. The 256 error code is indicating that the lilypond executable isn't found. And yet, Fosc.lilypondPath returns a valid path to a lilypond executable, and that path works fine when used directly in the terminal.
Beyond that, I don't know how to reproduce the problem you've run into. I've installed lilypond in /opt/local/bin on my machine and set this as Fosc.lilypondPath. It's all working fine.
I wonder if you could try one more thing? In the source file for FoscIOManager.sc, add this one hook in the *runLilypond method, after the line that sets the command variable:
command = "% % % %".format(executablePath, flags, outputPath.shellQuote, path.shellQuote); command.postln;
This will post what's being passed as the argument to systemCmd.
/opt/local/bin/lilypond -dno-point-and-click -o '/Users/name/Library/Application Support/SuperCollider/fosc-output/0002' '/Users/name/Library/Application Support/SuperCollider/fosc-output/0002.ly'
ERROR: FoscIOManager:openFile: path does not exist: /Users/name/Library/Application Support/SuperCollider/fosc-output/0002.pdf.
CALL STACK:
Object:reportError
arg this = "FoscIOManager:openFile: path..."
Nil:handleError
arg this = nil
arg error = "FoscIOManager:openFile: path..."
Thread:handleError
arg this =
Everything in the above is correct.
I don't think this is a permissions issue as you'd have the same result in the terminal if it was. But it's not impossible that systemCmd is being blocked by the OS for some reason or other. Could you try it with runInTerminal, and then with unixCmd, as below:
m = "/opt/local/bin/lilypond -dno-point-and-click -o '/Users/name/Library/Application Support/SuperCollider/fosc-output/0001' '/Users/name/Library/Application Support/SuperCollider/fosc-output/0001.ly'";
runInTerminal(m);
unixCmd(m);
runInTerminal(m);
throws an error I've never seen (btw, I am on Ventura 13.2.1):
“SCStringForTerminal115235862.command” can’t be opened because (null) is not allowed to open documents in Terminal.
unixCmd(m);
returns -> 1266
I'm assuming that unixCmd failed to generate a PDF in the fosc-output directory?
Indeed it failed.
Both SC and Terminal have Full Disk Access, there shouldn't be an issue with privileges I think... Are you on Ventura as well ?
No, I'm still on Monterey and I'm starting to wonder if it's some kind of security hook that's specific to Ventura that's causing the problem. But if it is, I'd have thought it would have been picked up by the SC devs by now. I don't read the SC forum anymore but a quick search there doesn't point to any problems with Ventura. When did you last update your SC build?
It's weird. I'm on SC 3.13.0-rc2. I will try to give this a go in another computer when possible.
Well that's pretty close to bleeding edge. I've just done a search in the supercollider github repo and can't see any relevant Ventura-specific issues being reported there either. If you get a chance to test on an earlier OS, please report back.
Just tried this on an old intel macbook running High Sierra 10.13.6, I get exactly the same error in SC 3.12.2 and Lilypond version 2.24.1.
It has me stumped, I'm afraid. There's quite a few people using Fosc and I've never seen anything like this before.
I've just installed SC 13.3.0 and Lilypond 2.24.1 and it's all working fine.
Can you run regular terminal commands from SC using systemCmd? e.g.: systemCmd("ls -l /opt/local/bin")
A friend of mine tried this on SC 3.12 on Monterey with an M1 chip, and had exactly the same issue. There's something weird going on here: Lilypond -when run from terminal- is able to create a .pdf file from a .ly file; however, the very same command throws an error when run from SuperCollider using the systemCmd
method. Makes no sense ....
I'm on a similar set-up but I can't reproduce the problem: M1, Monterey, SC 13.3.0, Lilypond 2.24.1. It still seems to me that the most likely explanation is related to permissions/access, but I can't pinpoint it without being able to reproduce the behaviour. I have two more suggestions to try:
1) Reset the permissions for the lilypond executables in a terminal: chmod 755 /opt/local/bin/*
2) Try moving the lilypond executables to somewhere in your home directory. Reset Fosc.lilypondPath to match the new location.
If neither of those works then it may be worth asking on the SC forum.
Hi there,
The following code does not seem to work on MacOS.
Fosc.lilypondPath = "/Applications/LilyPond.app/Contents/Resources/bin/lilypond";
I could not find "LilyPond.app" on the Internet. Where can I download it?
a = FoscNote(60, 1/4); a.show;
I get the following error in SuperCollider on an Apple M1:
ERROR: FoscIOManager:openFile: path does not exist: /Users/name/Library/Application Support/SuperCollider/fosc-output/0001.pdf. CALL STACK: Object:reportError arg this = "FoscIOManager:openFile: path..." Nil:handleError arg this = nil arg error = "FoscIOManager:openFile: path..." Thread:handleError arg this =
arg error = "FoscIOManager:openFile: path..."
Object:throw
arg this = "FoscIOManager:openFile: path..."
Meta_FoscIOManager:openFile
arg this =
arg path = "/Users/name/Library/A..."
Fosc:show
arg this =
arg paperSize = nil
arg staffSize = nil
arg includes = nil
var illustrateEnvir =
var path = "/Users/name/Library/A..."
Interpreter:interpretPrintCmdLine
arg this =
var res = nil
var func =
var code = "a.show;"
var doc = nil
var ideClass =
Process:interpretPrintCmdLine
arg this =
The 0001.ly file created within fosc-output contains the following:
\version "2.24.1" \language "english"
\include "/Users/name/Library/Application Support/SuperCollider/Extensions/fosc/stylesheets/default.ily"
\score { { c'4 } }