Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trial
Adam Cameron
Python Web Development Techdegree Graduate 16,731 PointsTrying to understand this error I get when I run a doctest?
I'm trying to run doctests using python3 -m doctest worklog-db.py as Kenneth shows us in the testing course, but I get this error:
Traceback (most recent call last):
File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/runpy.py", line 184, in _run_module_as_main
"__main__", mod_spec)
File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/runpy.py", line 85, in _run_code
exec(code, run_globals)
File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/doctest.py", line 2778, in <module>
sys.exit(_test())
File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/doctest.py", line 2768, in _test
failures, _ = testmod(m, verbose=verbose, optionflags=options)
File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/doctest.py", line 1941, in testmod
for test in finder.find(m, name, globs=globs, extraglobs=extraglobs):
File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/doctest.py", line 924, in find
self._find(tests, obj, name, module, source_lines, globs, {})
File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/doctest.py", line 983, in _find
if ((inspect.isroutine(inspect.unwrap(val))
File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/inspect.py", line 471, in unwrap
while _is_wrapper(func):
File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/inspect.py", line 465, in _is_wrapper
return hasattr(f, '__wrapped__')
File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/peewee.py", line 318, in __getattr__
return self[attr]
KeyError: '__wrapped__'
Anyone have any idea what this is about?
1 Answer
Kenneth Love
Treehouse Guest TeacherYou sent me your code and I gave it a look. You're not doing anything wrong, at least not regarding your doctests. The problem comes from Peewee. I filed an issue here about it.
To fix it in the meantime, though, use import peewee (instead of from peewee import *) and then prepend peewee. to all of your Peewee-provided objects. For instance, peewee.Model instead of just Model.
Adam Cameron
Python Web Development Techdegree Graduate 16,731 PointsAdam Cameron
Python Web Development Techdegree Graduate 16,731 PointsOkay this seems to be working! Thanks Kenneth!