Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #8106

Re: running an existing script

Date 2011-06-21 11:32 -0700
From Ethan Furman <ethan@stoneleaf.us>
Subject Re: running an existing script
References <e7c49eba-987f-4192-bfb6-afe0b0eddfbd@l6g2000vbn.googlegroups.com>
Newsgroups comp.lang.python
Message-ID <mailman.232.1308680352.1164.python-list@python.org> (permalink)

Show all headers | View raw


Adam Chapman wrote:
> Hi,

Howdy!

> I'm trying to put together a lot of pieces of source code in matlab,
> java, perl and python.

[snippety]

> Basically I just want to run a single script from the python command
> window. Once I know how to do that I can be off on my way to perform
> the matlab interfacing.
> 
> there is an example of the command I need in the python prompt at
> http://jboost.sourceforge.net/doc.html#cv .

That looks like a shell prompt, not a Python prompt

> however, I can't seem to run the python script by typing the command
> on that link in the python prompt.
> 
> Can I please ask how to set the current duirectory in python?

nfold.py is a python script -- you can't just type in the name once 
inside python and have it work.  It would require something like

--> import os
--> os.chdir('path/to/nfold.py') # don't include nfold.py ;)
--> import nfold
--> import sys
--> sys.argv = ["--folds=5", "--data=spambase.data",
... "--spec=spambase.spec", "--rounds=500", "--tree=ADD_ALL",
... "--generate" ]
...
--> nfold.main()  # assuming it has a main function that can be called
                   # in this manner

and that probably won't work.  What you probably want to do is execute 
the command "python /path/to/nfold.py --fold=5 ..." (include the 
nfold.py this time ).  I have no idea how to do that from Matlab.

Good luck!

~Ethan~

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

running an existing script Adam Chapman <adamchapman1985@hotmail.co.uk> - 2011-06-21 10:45 -0700
  Re: running an existing script Ethan Furman <ethan@stoneleaf.us> - 2011-06-21 11:32 -0700
  Re: running an existing script Benjamin Kaplan <benjamin.kaplan@case.edu> - 2011-06-21 11:25 -0700
  Re: running an existing script Ethan Furman <ethan@stoneleaf.us> - 2011-06-21 12:00 -0700
    Re: running an existing script Adam Chapman <adamchapman1985@hotmail.co.uk> - 2011-06-21 13:12 -0700
      Re: running an existing script Adam Chapman <adamchapman1985@hotmail.co.uk> - 2011-06-22 08:54 -0700
        Re: running an existing script Chris Rebert <clp2@rebertia.com> - 2011-06-22 09:13 -0700
        Re: running an existing script Ethan Furman <ethan@stoneleaf.us> - 2011-06-22 09:35 -0700
        Re: running an existing script Adam Chapman <adamchapman1985@hotmail.co.uk> - 2011-06-22 09:15 -0700
          Re: running an existing script Ethan Furman <ethan@stoneleaf.us> - 2011-06-22 09:51 -0700
            Re: running an existing script Adam Chapman <adamchapman1985@hotmail.co.uk> - 2011-06-22 09:51 -0700
              Re: running an existing script Adam Chapman <adamchapman1985@hotmail.co.uk> - 2011-06-22 10:13 -0700
                Re: running an existing script Ethan Furman <ethan@stoneleaf.us> - 2011-06-22 10:46 -0700
                Re: running an existing script Adam Chapman <adamchapman1985@hotmail.co.uk> - 2011-06-22 10:54 -0700
                Re: running an existing script Ethan Furman <ethan@stoneleaf.us> - 2011-06-22 11:50 -0700

csiph-web