From: Toni B. <hih...@go...> - 2016-03-18 05:27:35
|
Am 17.03.2016 um 21:46 schrieb honas grael: > > Hi I'm using python's cmd.cmd module(aka cmd module), essentially I > have a function like > > |do_simple_test(line)*run the test file*| > > When I run it, I get a nice little console typing > |simple_test(test_filename.txt)|, allows me to run the tests contained > in the text file that I typed in. > > This works well, but I want to take the automation one step further. I > converted my *main.py* into an executable *main.exe* using py2exe. It > still works fine. > > What I now want is to be able to launch main.exe with the > test_filename.txt as a parameter so > > |main.exe test_filename.txt| > > so that it will execute > > |simple_test(test_filename.txt)| > > That would give me the freedom to change the argument with which I > call main.exe, without having to type the appropriate command in the > console window. > > I am running python 2.7.10 on Windows Is it possible to do this, and how? > > Thank you > > > > ------------------------------------------------------------------------------ > Transform Data into Opportunity. > Accelerate data analysis in your applications with > Intel Data Analytics Acceleration Library. > Click to learn more. > http://pubads.g.doubleclick.net/gampad/clk?id=278785231&iu=/4140 > > Hi, > > this isn't actually a py2exe question. What stops you from doing it > the old fashioned way? > import sys > do_simple_test(sys.argv[1]) > > or actually implement an argument parser for your program. That way > you could actually add some more arguments to your program. Use the > argparse module to do that (import argparse). > > Both ways should be fully compatible to py2exe. > > Best Regards. > > Toni > > > _______________________________________________ > Py2exe-users mailing list > Py2...@li... > https://lists.sourceforge.net/lists/listinfo/py2exe-users |