[Tutor] mamelauncher (fwd)

Danny Yoo dyoo at hkn.eecs.berkeley.edu
Tue Sep 13 19:27:09 CEST 2005


Hi Max,

[Keeping tutor at python.org in CC.  Please do not send replies only to me:
make sure tutor at python.org is being included in the reply.]



[Danny]
>> Hint: in the defintion of run_mame_selection, there's some string
>> concatenation going on here:
>>
>> ######
>> def run_mame_selection(selection):
>>    os.system("C:\\mame096b\\mame.exe"+""+selection)
>> ######
>>
>> Why the empty string?


[Max]
> Launching mame without any specified string from the command line
> defaults to PacMan, so I was trying that out!


I'm not quite sure I understand your response, and I'm also not quite sure
you understood my hint.  *grin*

Let's back up for a moment.

Ok, it sounds like if we just run mame.exe without any arguments, it
should run PacMan by default.  Can you try that out?

######
def run_packman():
    os.system("C:\\mame096b\\mame.exe")
######

Does this work?  I'm trying to see if we can isolate exactly where things
start to break and not work as expected.


Also, does this work?

######
def run_packman():
    os.system("C:\\mame096b\\mame.exe packman")
######


Finally, what about this?

######
def run_mame_selection(selection):
    os.system("C:\\mame096b\\mame.exe"+""+selection)

def run_packman():
    run_mame_selection('packman')
######


As a side note: you may want to test the programs through IDLE; if you run
the program through IDLE, then if you run into problems, you should still
be able to see the error message that comes up.

If you run the program as a standalone on Windows, debugging this is
slightly more complicated because Windows closes a program's windows as
soon as a program's done.

Good luck!



More information about the Tutor mailing list