Movatterモバイル変換
[0]ホーム
PyChecker - a python source code bug finder
Andrew Kuchlingakuchlin at mems-exchange.org
Mon Apr 9 10:03:14 EDT 2001
David Lees <debl at nonospamyytheworld.com> writes:> You have diagnosed the problem. I wrote this particular code as a> standalone, command line driven routine that has defaults when no> arguments are present. So when I import my module it uses defaults,> which are intended for a linux box at work, not the Win98 box at home> and it hangs. Clearly sloppyness on my part. I need to do some error> checking.You probably want to add a block like this to run the main-line code;it won't get executed when the module is imported by another module.if __name__ == '__main__': # Invoke your command-line code here ...Search through the standard library for lots of examples of thisidiom.--amk
More information about the Python-listmailing list
[8]ページ先頭