-
Notifications
You must be signed in to change notification settings - Fork 1
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
wolframscript: command not found #3
Comments
Hi @LEMettler, I think I know what is going wrong. When setting a custom path, the quotes are being added to the path. when they should not. Instead of being Since this should be an easy fix I'll push the changes asap and I'll let you know! For the time being, I guess you could just copy the generated code and run it yourself. |
Ok, I've just tested and it is clearly not that, could you try to run this command |
Hi @MarcosNicolau, thank you for your quick reply. |
It probably has to do with the PATH env var not being loaded. Since you told you were able to use the plugin via git clone, would you mind replacing the export const getBase64Plot = async (
plot: string,
{ useCloud, wolframScriptPath }: GetBase64PlotSettings
): Promise<{ error: string; base64: string }> => {
try {
const { stdout, stderr } = await promisify(exec)(
`${
wolframScriptPath
? '"' + wolframScriptPath + '"'
: "wolframscript"
} ${
useCloud ? "--cloud" : ""
} --code "ExportString[${plot}, {\\"Base64\\", \\"PNG\\"}]"`,
{
// Here we make sure that the path gets loaded
env: { PATH: process.env.PATH },
}
);
if (stderr) return { error: stderr, base64: "" };
// If it is not a valid image, it means there was a mistake in the wolfram syntax
// So we return the base64 to debug the err, since it tells you whats wrong.
if (!isValidBase64(stdout)) return { error: stdout, base64: "" };
return { error: "", base64: stdout };
} catch (err) {
return { error: err, base64: "" };
}
}; After that, you'd have to run Sorry that I am making you do this, but I have no way to test it on my end since it works on my machine 😁. |
No worries. I appreciate your help :) I did as you instructed. Same error.
I never worked with js/ts. Is the second line is the expected output? |
Yes, the output is ok. If it's still not working, it is because exec creates a new process and a new shell, but for some reason, it is not creating the Could you try this version please: export const getBase64Plot = async (
plot: string,
{ useCloud, wolframScriptPath }: GetBase64PlotSettings
): Promise<{ error: string; base64: string }> => {
try {
console.log(process.env.PATH);
const { stdout, stderr } = await promisify(exec)(
`"wolframscript" ${
useCloud ? "--cloud" : ""
} --code "ExportString[${plot}, {\\"Base64\\", \\"PNG\\"}]"`,
{ env: { PATH: "/usr/bin/" } }
);
if (stderr) return { error: stderr, base64: "" };
// If it is not a valid image, it means there was a mistake in the wolfram syntax
// So we return the base64 to debug the err, since it tells you whats wrong.
if (!isValidBase64(stdout)) return { error: stdout, base64: "" };
return { error: "", base64: stdout };
} catch (err) {
return { error: err, base64: "" };
}
}; As you probably noticed, there is a console log that prints the PD: sorry for the delayed response! 😁 |
I got it to work! Solution: switching from flatpak to a .deb obsidian installation.Before, I tested the console output of the PATH env. It was not empty, but i can confirm that it did not match my defined Anyway, thank you very much for your help. Have a great day! |
Excellent!!! Glad you could solve the issue! I'll make sure to make it work on flatpak for the next release!! Thank you for opening the issue and helping with the bugs!! 😃 |
My local wolframscript is not found, however works in the terminal.
The installation went without a problem, but plots produce this type of error:
which wolframscript
returns/usr/bin/wolframscript
. However, entering this path in the settings also does not work:OS: Linux Mint 21.2
Obsidian: v1.5.8
Other things i tested:
I tried to have a look at it myself but i have no experience with javascript and did not get very far :)
The text was updated successfully, but these errors were encountered: