Loading ...
Sorry, an error occurred while loading the content.

Re: aima-python doctest problem "AttributeError: 'NoneType' object has no attribute"

Expand Messages
  • darius_bacon
    I was able to reproduce this error by running python doctests.py with no arguments. Apparently doctest.master starts out as None and gets initialized when
    Message 1 of 2 , Oct 24, 2011
    View Source
    • 0 Attachment
      I was able to reproduce this error by running "python doctests.py" with no arguments. Apparently doctest.master starts out as None and gets initialized when doctest.testmod() is called, so this is a bug in doctests.py. Can you run "python doctests.py *.py" instead with no errors? This bug will have to be fixed, of course, but it shouldn't affect anything else.

      Darius

      --- In aima-talk@yahoogroups.com, "damo_78@..." <damo_78@...> wrote:
      >
      > I'm trying to use the aima-python code to use in the online ai-class course from Standford. I'm new to python but have followed the instructions on the wiki fully. I have the latest svn version and the associated data downloaded. The following is the code I'm trying to run, and following that is the error. If anyone can help I would really appreciate it because I'm already falling behind on the course trying to resolve this.
      >
      > """Run all doctests from modules on the command line. Use -v for verbose.
      >
      > Example usages:
      >
      > python doctests.py *.py
      > python doctests.py -v *.py
      >
      > You can add more module-level tests with
      > __doc__ += "..."
      > You can add stochastic tests with
      > __doc__ += random_tests("...")
      > """
      >
      > if __name__ == "__main__":
      > import sys, glob, doctest
      > args = sys.argv[1:]
      > modules = [__import__(name.replace('-v *.py',''))
      > for arg in args if arg != "-v" for name in glob.glob(arg)]
      > for module in modules:
      > doctest.testmod(module, report=1)
      > print '%d failed out of %d' % doctest.master.summarize()
      >
      > The responding error....
      >
      > Traceback (most recent call last):
      > File "C:\Python27\lib\bdb.py", line 383, in run
      > exec cmd in globals, locals
      > File "C:\Python27\aima\aima-python\doctests.py", line 12, in <module>
      > """
      > AttributeError: 'NoneType' object has no attribute 'summarize'
      >
    Your message has been successfully submitted and would be delivered to recipients shortly.