Newbie -> NameError: getopt

R. Tyler Croy tyler at linux.com
Mon Apr 4 12:24:40 EDT 2011


On 2011年4月04日 05:14:46 -0700, Mustafa Cayci wrote:
> Hello,
>> I followed several postings in Google and came up with the beginning of
> the following code:
> During the execution, I am getting
>> Problem invoking WLST - Traceback (innermost last):
> File "/home/oracle/wlsuserconfigfiles/./Health_Check_Servers.py", line
> 80, in
> ?
> File "/home/oracle/wlsuserconfigfiles/./Health_Check_Servers.py", line
> 22, in
> main
> NameError: getopt
>> I thought I was importing the "getopt" as shown below.

Try bringing your imports up out of the "if __name__" block. Where you are 
referencing getopt (the main() function), the getopt module hasn't yet 
been imported.
You can do something like this:
 import getopt
 def main():
 # ...
-- 
- R. Tyler Croy
--------------------------------------
 Code: http://github.com/rtyler


More information about the Python-list mailing list

AltStyle によって変換されたページ (->オリジナル) /