running an existing script

Ethan Furman ethan at stoneleaf.us
Tue Jun 21 15:00:39 EDT 2011


Adam Chapman wrote:
> Thanks Ethan
> 
> No way could I have worked that out in my state of stress!
> 
> For your second idea, would I need to type that into the python command 
> line interface (the one that looks like a DOS window?

If you are actually in a python CLI, at the top of that screen does it 
say something like

Python 2.5.4 (r254:67916, Dec 23 2008, 15:10:54) [MSC v.1310 32 bit 
(Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.

?

If yes, then what I wrote earlier should actually work (I downloaded 
jBoost and looked at the nfold.py script).  Here it is again:

--> import os
--> os.chdir('path/to/nfold.py') # don't include nfold.py  ;)
--> import nfold
--> import sys
--> sys.argv = ["nfold.py", "--folds=5", "--data=spambase.data",
... "--spec=spambase.spec", "--rounds=500", "--tree=ADD_ALL",
... "--generate" ]
...
--> nfold.main()

I fixed the sys.argv line from last time.

Good luck!

~Ethan~



More information about the Python-list mailing list