Skip to content

How to use FileAttachment on a gif file in root directory? #1077

Answered by gganapat
gganapat asked this question in Q&A
Discussion options

You must be logged in to vote

The data loader file for wolframscript (assuming it is your $PATH) is very simple -- you have to name it ending in .exe (even if you are on a Mac like I am!), so my file was named wolfram.txt.exe and stored in docs/data folder. The resulting plot is also stored in the same folder by setting the right path in Mathematica. The resulting outputs can be simply referenced in markdown and html tag. Very convenient - no need for display(xxx) in js block, etc.

#!/usr/bin/env wolframscript
b = Integrate[1/(x^4 + 1), x]/.{x->2.0}
Print[b]
cwd=Directory[]
dir = StringJoin[cwd<>"/docs"<>"/data"]
Export[StringJoin[dir<>"/test.gif"], Plot[Sin[x], {x, 0, 10}]]

The wolfram.md file is

And the result is

Replies: 3 comments 3 replies

Comment options

You must be logged in to vote
2 replies
@Fil
Comment options

@gganapat
Comment options

Comment options

You must be logged in to vote
1 reply
@Fil
Comment options

Answer selected by Fil
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants