running an existing script

Benjamin Kaplan benjamin.kaplan at case.edu
Tue Jun 21 14:25:16 EDT 2011


On Tue, Jun 21, 2011 at 10:45 AM, Adam Chapman
<adamchapman1985 at hotmail.co.uk> wrote:
> Hi,
>
> I'm trying to put together a lot of pieces of source code in matlab,
> java, perl and python.
>
> Im an expert when it comes to matlab, but novice in all the others
> listed above. However, I have integrated the java and perl code so
> they can be called from matlab.
>
> I know that there is a toolbox out there called Pymat but i think that
> uses 32bit activex so rules my configuration out.
>
> However I think I can hack in to the python command prompt from
> matlab.
>
> 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 .
>
> however, I can't seem to run the python script by typing the command
> on that link in the python prompt.
>

That command they show isn't run from a Python shell. It's run from
either a Unix shell (bash and friends) or a Windows command prompt
(cmd). If you want to run a script, you have to give the path to that
script. ./ means the current directory and .. is the parent directory
if you want to give relative paths, or you can just write out the
whole file path.

> Can I please ask how to set the current duirectory in python?
>

os.chdir changes the current directory, but you probably don't need to do that.

> the script I want to run is in a different directory to the one python
> is installed to
> --
> http://mail.python.org/mailman/listinfo/python-list
>



More information about the Python-list mailing list