running an existing script
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. Can I please ask how to set the current duirectory in python? 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
Re: running an existing script
On Jun 21, 8:00 pm, Ethan Furman wrote: > 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~ Thanks to both of you for your help. It's getting late here, I'll give it another try tomorrow -- http://mail.python.org/mailman/listinfo/python-list
Re: running an existing script
On Jun 21, 9:12 pm, Adam Chapman wrote: > On Jun 21, 8:00 pm, Ethan Furman wrote: > > > > > > > > > > > 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~ > > Thanks to both of you for your help. > > It's getting late here, I'll give it another try tomorrow I've added the python directories to the environment variable "path" in my computer (http://showmedo.com/videotutorials/video? name=96&fromSeriesID=96), which means I can now call python from the windows DOS-style command prompt. My formatting must be wrong when calling the nfold.py script to run. My connad prompt call and the computer's response look like this: C:\Users\Adam\Desktop\JBOOST\jboost-2.2\jboost-2.2\scripts>nfold.py nfold.py File "C:\Users\Adam\Desktop\JBOOST\jboost-2.2\jboost-2.2\scripts \nfold.py", line 13 print 'Usage: nfold.py <--booster=boosttype> <--folds=number> [-- generate | --dir=dir] [--data=file --spec=file] [--rounds=number -- tree=treetype]' ^ SyntaxError: invalid syntax What I dont understand is that some of the parameters in the syntax it printed back are in <> brackets, and others in [] brackets. I assume this is something a regular python user could notice straight away. Please let me know, I'd be very grateful -- http://mail.python.org/mailman/listinfo/python-list
Re: running an existing script
On Jun 22, 4:54 pm, Adam Chapman wrote: > On Jun 21, 9:12 pm, Adam Chapman > wrote: > > > > > > > > > > > On Jun 21, 8:00 pm, Ethan Furman wrote: > > > > 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~ > > > Thanks to both of you for your help. > > > It's getting late here, I'll give it another try tomorrow > > I've added the python directories to the environment variable "path" > in my computer (http://showmedo.com/videotutorials/video? > name=96&fromSeriesID=96), which means I can now call python from > the windows DOS-style command prompt. > > My formatting must be wrong when calling the nfold.py script to run. > My connad prompt call and the computer's response look like this: > > C:\Users\Adam\Desktop\JBOOST\jboost-2.2\jboost-2.2\scripts>nfold.py > nfold.py > File "C:\Users\Adam\Desktop\JBOOST\jboost-2.2\jboost-2.2\scripts > \nfold.py", line 13 > print 'Usage: nfold.py <--booster=boosttype> <--folds=number> [-- > generate | --dir=dir] [--data=file --spec=file] [--rounds=number -- > tree=treetype]' > > ^ > SyntaxError: invalid syntax > > What I dont understand is that some of the parameters in the syntax it > printed back are in <> brackets, and others in [] brackets. > > I assume this is something a regular python user could notice straight > away. > > Please let me know, I'd be very grateful I just tried nfold.py --booster=Adaboost --folds=5 --data=spambase.data -- spec=spambase.spec --rounds=500 --tree=ADD_ALL --generate --dir=C: \Users\Adam\Desktop\cvdata in the dos-style command prompt. It didn'g vive a syntax error this time, it just repeated my command back to me in text. I assume I called code correctly, but it didn't make a new folder full of data like it should have. -- http://mail.python.org/mailman/listinfo/python-list
Re: running an existing script
On Jun 22, 5:51 pm, Ethan Furman wrote: > Adam Chapman wrote: > > On Jun 22, 4:54 pm, Adam Chapman > > wrote: > >> On Jun 21, 9:12 pm, Adam Chapman > >> wrote: > > >>> On Jun 21, 8:00 pm, Ethan Furman wrote: > >>>> 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~ > >>> Thanks to both of you for your help. > >>> It's getting late here, I'll give it another try tomorrow > >> I've added the python directories to the environment variable "path" > >> in my computer (http://showmedo.com/videotutorials/video? > >> name=96&fromSeriesID=96), which means I can now call python from > >> the windows DOS-style command prompt. > > >> My formatting must be wrong when calling the nfold.py script to run. > >> My connad prompt call and the computer's response look like this: > > >> C:\Users\Adam\Desktop\JBOOST\jboost-2.2\jboost-2.2\scripts>nfold.py > >> nfold.py > >> File "C:\Users\Adam\Desktop\JBOOST\jboost-2.2\jboost-2.2\scripts > >> \nfold.py", line 13 > >> print 'Usage: nfold.py <--booster=boosttype> <--folds=number> [-- > >> generate | --dir=dir] [--data=file --spec=file] [--rounds=number -- > >> tree=treetype]' > > >> ^ > >> SyntaxError: invalid syntax > > >> What I dont understand is that some of the parameters in the syntax it > >> printed back are in <> brackets, and others in [] brackets. > > >> I assume this is something a regular python user could notice straight > >> away. > > >> Please let me know, I'd be very grateful > > > I just tried > > > nfold.py --booster=Adaboost --folds=5 --data=spambase.data -- > > spec=spambase.spec --rounds=500 --tree=ADD_ALL --generate --dir=C: > > \Users\Adam\Desktop\cvdata > > > in the dos-style command prompt. It didn'g vive a syntax error this > > time, it just repeated my command back to me in text. I assume I > > called code correctly, but it didn't make a new folder full of data > > like it should have. > > Which version of jBoost, and which version of Python? > > ~Ethan~ jboost 2.2, python 2.7 somehow I've just managed to delete all of the code in nfold.py, now downloading it again... -- http://mail.python.org/mailman/listinfo/python-list
Re: running an existing script
On Jun 22, 5:51 pm, Adam Chapman wrote: > On Jun 22, 5:51 pm, Ethan Furman wrote: > > > > > > > > > > > Adam Chapman wrote: > > > On Jun 22, 4:54 pm, Adam Chapman > > > wrote: > > >> On Jun 21, 9:12 pm, Adam Chapman > > >> wrote: > > > >>> On Jun 21, 8:00 pm, Ethan Furman wrote: > > >>>> 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~ > > >>> Thanks to both of you for your help. > > >>> It's getting late here, I'll give it another try tomorrow > > >> I've added the python directories to the environment variable "path" > > >> in my computer (http://showmedo.com/videotutorials/video? > > >> name=96&fromSeriesID=96), which means I can now call python from > > >> the windows DOS-style command prompt. > > > >> My formatting must be wrong when calling the nfold.py script to run. > > >> My connad prompt call and the computer's response look like this: > > > >> C:\Users\Adam\Desktop\JBOOST\jboost-2.2\jboost-2.2\scripts>nfold.py > > >> nfold.py > > >> File "C:\Users\Adam\Desktop\JBOOST\jboost-2.2\jboost-2.2\scripts > > >> \nfold.py", line 13 > > >> print 'Usage: nfold.py <--booster=boosttype> <--folds=number> [-- > > >> generate | --dir=dir] [--data=file --spec=file] [--rounds=number -- > > >> tree=treetype]' > > > >> ^ > > >> SyntaxError: invalid syntax > > > >> What I dont understand is that some of the parameters in the syntax it > > >> printed back are in <> brackets, and others in [] brackets. > > > >> I assume this is something a regular python user could notice straight > > >> away. > > > >> Please let me know, I'd be very grateful > > > > I just tried > > > > nfold.py --booster=Adaboost --folds=5 --data=spambase.data -- > > > spec=spambase.spec --rounds=500 --tree=ADD_ALL --generate --dir=C: > > > \Users\Adam\Desktop\cvdata > > > > in the dos-style command prompt. It didn'g vive a syntax error this > > > time, it just repeated my command back to me in text. I assume I > > > called code correctly, but it didn't make a new folder full of data > > > like it should have. > > > Which version of jBoost, and which version of Python? > > > ~Ethan~ > > jboost 2.2, python 2.7 > > somehow I've just managed to delete all of the code in nfold.py, now > downloading it again... Thanks a lot, must be getting close now... I changed the indentation one lines 136-168, and put in the command window: nfold.py --booster=Adaboost --folds=5 --data=spambase.data -- spec=spambase.spec --rounds=500 --tree=ADD_ALL --generate no syntax errors this time, it just said: nfold.py: Your CLASSPATH is not set. You must place jboost.jar in your CLASSPATH. is that the chdir() command in python? and can I somehow set that in the dos command window? -- http://mail.python.org/mailman/listinfo/python-list
Re: running an existing script
On Jun 22, 6:13 pm, Adam Chapman wrote: > On Jun 22, 5:51 pm, Adam Chapman > wrote: > > > > > > > > > > > On Jun 22, 5:51 pm, Ethan Furman wrote: > > > > Adam Chapman wrote: > > > > On Jun 22, 4:54 pm, Adam Chapman > > > > wrote: > > > >> On Jun 21, 9:12 pm, Adam Chapman > > > >> wrote: > > > > >>> On Jun 21, 8:00 pm, Ethan Furman wrote: > > > >>>> 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~ > > > >>> Thanks to both of you for your help. > > > >>> It's getting late here, I'll give it another try tomorrow > > > >> I've added the python directories to the environment variable "path" > > > >> in my computer (http://showmedo.com/videotutorials/video? > > > >> name=96&fromSeriesID=96), which means I can now call python from > > > >> the windows DOS-style command prompt. > > > > >> My formatting must be wrong when calling the nfold.py script to run. > > > >> My connad prompt call and the computer's response look like this: > > > > >> C:\Users\Adam\Desktop\JBOOST\jboost-2.2\jboost-2.2\scripts>nfold.py > > > >> nfold.py > > > >> File "C:\Users\Adam\Desktop\JBOOST\jboost-2.2\jboost-2.2\scripts > > > >> \nfold.py", line 13 > > > >> print 'Usage: nfold.py <--booster=boosttype> <--folds=number> [-- > > > >> generate | --dir=dir] [--data=file --spec=file] [--rounds=number -- > > > >> tree=treetype]' > > > > >> ^ > > > >> SyntaxError: invalid syntax > > > > >> What I dont understand is that some of the parameters in the syntax it > > > >> printed back are in <> brackets, and others in [] brackets. > > > > >> I assume this is something a regular python user could notice straight > > > >> away. > > > > >> Please let me know, I'd be very grateful > > > > > I just tried > > > > > nfold.py --booster=Adaboost --folds=5 --data=spambase.data -- > > > > spec=spambase.spec --rounds=500 --tree=ADD_ALL --generate --dir=C: > > > > \Users\Adam\Desktop\cvdata > > > > > in the dos-style command prompt. It didn'g vive a syntax error this > > > > time, it just repeated my command back to me in text. I assume I > > > > called code correctly, but it didn't make a new folder full of data > > > > like it should have. > > > > Which version of jBoost, and which version of Python? > > > > ~Ethan~ > > > jboost 2.2, python 2.7 > > > somehow I've just managed to delete all of the code in nfold.py, now > > do