[Python-Dev] pychecker on 2.2 current

Fred L. Drake, Jr. fdrake@acm.org
Wed, 5 Dec 2001 11:36:19 -0500

Neal Norwitz writes:
 > mimetypes.py:405: No global (sys) found
 > This is inside usage() which presumably should only be used internally.  
 > sys is imported if __name__ == '__main__'.
 > So the problem can only be triggered if usage() is called by external source.
 > Possible fixes are:
 > 	sys could be locally imported in usage()
 > 	sys could be imported at the module scope
 > 	usage could be made _usage() to denote it's private

  I'll propose another fix, but I don't know what pychecker would
say.  ;-)  I'd like to move the definition of usage() into the if
__name__ == "__main__" block, in which case the problem goes away
since there wouldn't be a usage() unless sys has been imported.
  I'll check it in that way.  ;-)


Fred L. Drake, Jr.  <fdrake at acm.org>
PythonLabs at Zope Corporation