
Only found one potential problem: 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 Neal

Neal Norwitz writes:
Neal, 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 -- Fred L. Drake, Jr. <fdrake at acm.org> PythonLabs at Zope Corporation

I thought pychecker would complain, but it's happy too. :-)
But isn't that because the new code is all at the module-global level, which pychecker doesn't "see"? Or have you fixed that yet? --Guido van Rossum (home page: http://www.python.org/~guido/)

Guido van Rossum wrote:
pychecker does "see" all code at the module level, but it isn't perfect. If there is code like: import sys if sys.platform == 'win32': def x(a, b): pass else: def x(a): pass The following incorrect warning is produced: t2.py:5: Redefining attribute (x) original line (3) Because both versions of the function x() are seen. Neal

I stand corrected. I think this was the case for an older version?
Hm, I would call that warning correct. :-) --Guido van Rossum (home page: http://www.python.org/~guido/)

Neal Norwitz writes:
Neal, 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 -- Fred L. Drake, Jr. <fdrake at acm.org> PythonLabs at Zope Corporation

I thought pychecker would complain, but it's happy too. :-)
But isn't that because the new code is all at the module-global level, which pychecker doesn't "see"? Or have you fixed that yet? --Guido van Rossum (home page: http://www.python.org/~guido/)

Guido van Rossum wrote:
pychecker does "see" all code at the module level, but it isn't perfect. If there is code like: import sys if sys.platform == 'win32': def x(a, b): pass else: def x(a): pass The following incorrect warning is produced: t2.py:5: Redefining attribute (x) original line (3) Because both versions of the function x() are seen. Neal

I stand corrected. I think this was the case for an older version?
Hm, I would call that warning correct. :-) --Guido van Rossum (home page: http://www.python.org/~guido/)
participants (3)
-
Fred L. Drake, Jr.
-
Guido van Rossum
-
Neal Norwitz