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
                " > /Users/daviddreisigmeyer/lisps/clojure/dpa/src/hold.xyzr")))

Here it seemed to run (the above error isn't shown) but nothing
happened and the REPL become unresponsive again.  The call above only
takes a few seconds if I run it in a terminal using the output of (str
"...").

When I try:

(ns msms
  (:gen-class)
  (:use [clojure.contrib.duck-streams :only (read-lines)]
        [clojure.contrib.shell-out :only (sh)]))

(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]
  (sh :in (str "/Users/daviddreisigmeyer/msms_MacOSX_2.6.1/pdb_to_xyzr
" pdb-file
                " > /Users/daviddreisigmeyer/lisps/clojure/dpa/src/hold.xyzr")))

I get the following:

No matching method found: exec for class java.lang.Runtime
  [Thrown class java.lang.IllegalArgumentException]

so I'll need to look at that a bit more.

Does anyone know why this doesn't seem to work:

(defn test-execute [ls-arg1 ls-arg2]
  (execute (str "ls -" ls-arg1))
  (execute (str "ls -" ls-arg2)))

Thanks again.

-Dave

On Aug 6, 11:06 pm, j-g-faustus <johannes.fries...@gmail.com> wrote:
> On Aug 6, 11:50 pm, Dave <david.dreisigme...@gmail.com> 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 my settings from .bashrc
> or .profile.
>
> Workarounds I know of:
>
> - Use clojure.contrib.shell-out and supply a map of the environment
> variables you need, including the 
> path:http://richhickey.github.com/clojure-contrib/shell-out-api.html
>
> - Put the "pdb_to_xyzr" call into a shell script that sets the path
> for you, and call the shell script from your program.
>
> - Use the full path to the executable rather than relying on
> environment variables.
>
> - Use one of the Java Runtime.exec variants that takes a String array
> of environment variables. (Although I would recommend one of the other
> options - I don't think there's a direct way to create a String array
> in Clojure, but you could do it indirectly through String.split or
> similar.):http://download-llnw.oracle.com/javase/1.5.0/docs/api/java/lang/Runti...
>
> Regards
> jf

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Reply via email to