Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /**
- * Python Command (v2.0)
- * GoToLoop (2017/Jul/05)
- *
- * https://Forum.Processing.org/two/discussion/23324/
- * executing-python-3-code-from-within-processing#Item_38
- *
- * https://GitHub.com/GoToLoop/command/blob/patch-1/src/
- * deadpixel/command/Command.java
- */
- import deadpixel.command.Command;
- static final String BASH =
- platform == WINDOWS? "cmd /C " :
- platform == MACOSX? "open" : "xdg-open";
- static final String CD = "cd ", PY_APP = "python ";
- static final String AMP = " && ", SPC = " ";
- static final String PY_DIR = "scripts/";
- //static final String PY_FILE = PY_DIR + "abc.py";
- static final String PY_FILE = PY_DIR + "segmenting.py";
- static final String PICS_DIR = "images/";
- static final String PICS_EXTS = "extensions=,png,jpg,jpeg,gif";
- void setup() {
- final String dp = dataPath(""), py = dataPath(PY_FILE);
- final String prompt = BASH + CD + dp + AMP + PY_APP + py;
- final String pd = dataPath(PICS_DIR);
- final String pics = join(listPaths(pd, PICS_EXTS), SPC);
- final Command cmd = new Command(prompt + SPC + pics);
- println(cmd.command, ENTER);
- println("Successs:", cmd.run(), ENTER);
- printArray(cmd.getOutput());
- exit();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement