Re: System calls

2010-08-09 Thread Mike Meyer
On Mon, 9 Aug 2010 09:37:14 -0700 (PDT) Dave wrote: > Thanks jf, that worked: > > (ns msms > (:gen-class) > (:use [clojure.contrib.shell-out :only (sh)])) > > (defn get-msms-pts-OSX > [{pdb-file :pdb-file density :density radius :radius :as all :or > {density "1.0" radius "1.5"}}] > (if

Re: System calls

2010-08-09 Thread Dave
Thanks jf, that worked: (ns msms (:gen-class) (:use [clojure.contrib.shell-out :only (sh)])) (defn get-msms-pts-OSX [{pdb-file :pdb-file density :density radius :radius :as all :or {density "1.0" radius "1.5"}}] (if (contains? all :pdb-file) (sh "bash" :in (str "/Users/daviddreisigmey

Re: System calls

2010-08-07 Thread j-g-faustus
On Aug 7, 4:46 pm, Dave wrote: >   (execute (str "/../pdb_to_xyzr " pdb-file " > /.."))) > > Here it seemed to run (the above error isn't shown) but nothing > happened and the REPL become unresponsive again.   I think the issue is that Runtime.exec doesn't start a shell, just a subprocess, so thi

Re: System calls

2010-08-07 Thread Dave
Thanks everyone. I have already tried the full path: (defn get-msms-pts-OSX ;; Finds the msms points for a density (optional DEFAULT = 1.0) and radius (optional DEFAULT = 1.5) [pdb-file density radius] (execute (str "/Users/daviddreisigmeyer/msms_MacOSX_2.6.1/ pdb_to_xyzr " pdb-file

Re: System calls

2010-08-07 Thread j-g-faustus
On Aug 7, 7:27 am, Meikel Brandmeyer wrote: > (defn to-env >   [env-vars-map] >   (->> env-vars-map >     (map #(str (name (key %)) "=" (val %))) >     into-array)) > > And an invocation: > > user=> (to-env {:PATH "/bin:/usr/bin" :HOME "/Users/mb" :foo "bar"}) > # > user=> (seq *1) > ("PATH=/bin:/

Re: System calls

2010-08-06 Thread Adrian Cuthbertson
> :) (inc ":)") On Sat, Aug 7, 2010 at 7:27 AM, Meikel Brandmeyer wrote: > Hi, > > Am 07.08.2010 um 05:06 schrieb j-g-faustus: > >> I don't think there's a direct way to create a String array in Clojure > > (defn to-env >  [env-vars-map] >  (->> env-vars-map >    (map #(str (name (key %)) "=" (

Re: System calls

2010-08-06 Thread Meikel Brandmeyer
Hi, Am 07.08.2010 um 05:06 schrieb j-g-faustus: > I don't think there's a direct way to create a String array in Clojure (defn to-env [env-vars-map] (->> env-vars-map (map #(str (name (key %)) "=" (val %))) into-array)) And an invocation: user=> (to-env {:PATH "/bin:/usr/bin" :HOME

Re: System calls

2010-08-06 Thread j-g-faustus
On Aug 7, 5:06 am, j-g-faustus wrote: > I don't think there's a direct way to create a String array > in Clojure Correction - there is: (into-array String ["a" "b"]) jf -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send ema

Re: System calls

2010-08-06 Thread j-g-faustus
On Aug 6, 11:50 pm, Dave wrote: > I get the error: > > Cannot run program "pdb_to_xyzr": error=2, No such file or directory >   [Thrown class java.io.IOException] You may have a path problem. Try running "env" in the same fashion - I get a very basic path (just "/bin" and "/usr/bin") and none of

Re: System calls

2010-08-06 Thread Dave
Also, this only shows the 2nd call (with ls-arg2): (defn test-execute [ls-arg1 ls-arg2] (execute (str "ls -" ls-arg1)) (execute (str "ls -" ls-arg2))) so maybe the difficulty above is some problem with how the multiple system calls are performed. If I only use this: (d

System calls

2010-08-06 Thread Dave
I having some trouble with system calls using clojure (actually a whole lot more than that but this is the current day's difficulty). Below, test-execute works, but get-msms-pts-OSX seems to hang, as in nothing happens and the REPL is unresponsive afterwards. If I run the output of the