Mathematica 9 is now available
Services & Resources / Wolfram Forums / MathGroup Archive
-----

MathGroup Archive 2010

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

Search the Archive

Run a package from the command line without launching a notebook?

  • To: mathgroup at smc.vnet.net
  • Subject: [mg111714] Run a package from the command line without launching a notebook?
  • From: Garapata <warsaw95826 at mypacks.net>
  • Date: Wed, 11 Aug 2010 04:46:49 -0400 (EDT)

Hi everyone,

I run Mathematica on a Mac (Snow Leopard).

I need to run a package from the command line without launching a
notebook.

First, I created a notebook with four cells:

Needs["myPackages`myPackage`"]
connectionInfo = {"databaseDriver", "databaseLocation", "username",
password"};
workFlow[connectionInfo];
Quit[]

All pretty simple:

Needs[] loads a package that I've placed in an ExtraPackages
subdirectory.
connectionInfo gives database connection parameters.
workFlow[] runs some code and writes to the data base.
Quit[] should exit the kernel

This all works fine running in a notebook.

I took the notebook, made each cell an initialization cell, and saved
it as a package,
"myAutoRun.m"

I researched the documentation, the internet, and this forum and found
that MathKernel should start the Mathematica Kernel on Mac OS X

But now I don't know what I need to do in the terminal window to
launch the kernel and run the package.

I don't know my way around a terminal window or command prompt, so I'd
appreciate as explicit instructions as possible (especially defining
file paths and changing directories if I need to do so).

Thanks everyone,
G


  • Prev by Date: Re: Suggestions
  • Next by Date: Re: Equation solving question
  • Previous by thread: Frontend option settings
  • Next by thread: Re: Run a package from the command line without launching a notebook?