MathGroup Archive 2006

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Re: Re: Calling .exe with Arguments - Run[] Issue

  • To: mathgroup at smc.vnet.net
  • Subject: [mg66112] Re: [mg66074] Re: [mg66048] Re: Calling .exe with Arguments - Run[] Issue
  • From: "Chris Chiasson" <chris at chiasson.name>
  • Date: Sat, 29 Apr 2006 03:41:25 -0400 (EDT)
  • References: <e2ppk1$t2i$1@smc.vnet.net> <200604270936.FAA03754@smc.vnet.net> <4450BD11.4080601@gmail.com> <acbec1a40604271107x2c3ee489xc500d0fb5eeb158d@mail.gmail.com> <445142E5.2090109@gmail.com> <200604281033.GAA03197@smc.vnet.net> <44522AF2.5070504@gmail.com>
  • Sender: owner-wri-mathgroup at wolfram.com

Shyam,

After looking at your comments and making some additions to my
notebooks, I concur with your assessment; I believe there are problems
with space handling in Run.

Here are some examples:
http://chris.chiasson.name/Mathematica/mg66048
http://chris.chiasson.name/Mathematica/mg66048_with_space_in_path

For others, note that an exit error level of zero indicates success,
while an exit error of 1 indicates failure.

If you don't have a premier support account, send me a separate
message and I will file a bug report.

Regards,

On 4/28/06, Shyam Guthikonda <shyamguth at gmail.com> wrote:
> Chris -
>
> I really appreciate you taking the time to help me out. I'm glad you
> enjoy my name - I'm from Ohio (exciting!). This really isn't a huge deal
> - don't spend too much time on this. I am thinking it may be a bug in Run[].
>
> Here is a screenshot of my run of your notebook (all files are in the
> same directory). The batch file does not execute, and so it is returning 1:
>
> http://www.shyammichael.com/screenshot_000.jpg
>
> It works fine on your machine, because your directories do not have
> spaces in their names. In order to run this successfully on my machine,
> I must surround the first argument in " ":
>
> http://www.shyammichael.com/screenshot_001.jpg
>
> With these modifications, the .bat is executing (Run[] returns 0).
>
> Imagine now, that instead of passing the parameters "hi" and "up" as two
> parameters, you want to pass "hi up" as a single parameter (in my case,
> this is a directory with spaces). In order to pass "hi up" as a single
> parameter, you need to surround the string in " ", so that the space is
> ignored. This is where Run[] breaks - when you are trying to add these "
> " to the 2nd parameter.
>
> i.e. This should work (but it doesn't):
> Run["\""<>ToFileName[thisdir, executable]<>"\"", "\"hi up\""]
>
> which should pass this to the command line (typing this directly into
> the command line works):
> "C:\theDirectory\finalproject.bat" "hi up"
>
> _Shyam
>
>
> Chris Chiasson wrote:
> > Dear Shyam Guthikonda, (cool name. what country are you from? I'm from the USA)
> >
> > Your notebook is a little confusing to me, so I erased it and rewrote
> > it. Also, I haven't yet run your executable. I did make a bat file
> > with a similar name and tested that. I suspect your program might be
> > changing its own exit status to 1 after being called correctly - it's
> > hard to say because I don't know if your program pauses for user
> > input.
> >
> > Take a look at the notebook and batch file.
> >
> > (you're looking for mg66048.* and finalproject.bat)
> >
> > http://chris.chiasson.name/Mathematica/
> >
> > or just have the server guess for you
> >
> > http://chris.chiasson.name/Mathematica/mg66048
> >
> > Email if you need help. Good day.
> >
> > On 4/27/06, Shyam Guthikonda <shyamguth at gmail.com> wrote:
> >
> >> I created a small example notebook to show the problem. I uploaded
> >> everything to my webspace. Download it here:
> >> http://www.shyammichael.com/runProblem.zip
> >>
> >> I included the .exe. I put comments in each notebook cell showing the
> >> problem. Run it from top down.
> >>
> >> Thanks for taking the time to look at this. I've very interested to hear
> >> what the problem might be.
> >>
> >> _Shyam
> >>
> >> Chris Chiasson wrote:
> >>
> >>> If you would like to, send your notebook to me and I will take a look
> >>> at it. In the past, I have created a Mathematica script that
> >>> repeatedly runs an executable to collect data - so I have some idea of
> >>> what to do.
> >>>
> >>> On 4/27/06, Shyam Guthikonda <shyamguth at gmail.com> wrote:
> >>>
> >>>
> >>>> Chris Chiasson wrote:
> >>>>
> >>>>
> >>>>> InputForm is a function that affects printing. It does not return a
> >>>>> string. Try leaving it out
> >>>>>
> >>>>>
> >>>> Nope, I've tried it by manually entering both strings. I've tried
> >>>> putting them as a single parameter in Run[] separated by a space. I've
> >>>> tried putting them in 2 parameters in Run[], allowing Run[] to add the
> >>>> space. As soon as I add even one \" to the 2nd parameter the same
> >>>> behavior occurs.
> >>>>
> >>>> Quite odd...
> >>>>
> >>>> _Shyam
> >>>>
> >>>>
> >>>>
> >>> --
> >>> http://chris.chiasson.name/
> >>>
> >>>
> >>>
> >>
> >
> >
> > --
> > http://chris.chiasson.name/
> >
> >
> >
>
>


--
http://chris.chiasson.name/


  • Prev by Date: Re: Re: Re: Calling .exe with Arguments - Run[] Issue
  • Next by Date: Re: Conditions with Statistical Functions
  • Previous by thread: Re: Re: Re: Calling .exe with Arguments - Run[] Issue
  • Next by thread: Re: Issue