You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Python version: Python 3.3.0 (default, Mar 8 2013, 07:01:05)
When using the qtconsole, I don't seem to be able to use doctest.testmod(), as I get errors about how "'OutStream' object has no attribute 'encoding'". To demonstrate the problem, I created doctest_example.py:
def my_function(x, y):
"""
Adds x and y
>>> my_function(3, 5)
8
"""
return x + y
if __name__ == '__main__':
import doctest
doctest.testmod()
Running this with %run doctest_example.py in the QtConsole results in the error message:
---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
/usr/lib/python3/dist-packages/IPython/utils/py3compat.py in execfile(fname, glob, loc)
74 def execfile(fname, glob, loc=None):
75 loc = loc if (loc is not None) else glob
---> 76 exec(compile(open(fname, 'rb').read(), fname, 'exec'), glob, loc)
77
78 # Refactor print statements in doctests.
/home/marius/Programming/NLP/Assignment2/doctest_example.py in <module>()
10 if __name__ == '__main__':
11 import doctest
---> 12 doctest.testmod()
/usr/lib/python3.3/doctest.py in testmod(m, name, globs, verbose, report, optionflags, extraglobs, raise_on_error, exclude_empty)
1904
1905 for test in finder.find(m, name, globs=globs, extraglobs=extraglobs):
-> 1906 runner.run(test)
1907
1908 if report:
/usr/lib/python3/dist-packages/IPython/utils/doctestreload.py in f(*a, **k)
35 sys.displayhook = sys.__displayhook__
36 try:
---> 37 out = func(*a,**k)
38 finally:
39 sys.displayhook = dhook_s
/usr/lib/python3.3/doctest.py in run(self, test, compileflags, out, clear_globs)
1398 save_stdout = sys.stdout
1399 if out is None:
-> 1400 encoding = save_stdout.encoding
1401 if encoding is None or encoding.lower() == 'utf-8':
1402 out = save_stdout.write
AttributeError: 'OutStream' object has no attribute 'encoding'
The error doesn't seem to go away when toggling %doctest_mode.
The text was updated successfully, but these errors were encountered:
Ipython version: 0.13.1
Python version: Python 3.3.0 (default, Mar 8 2013, 07:01:05)
When using the qtconsole, I don't seem to be able to use
doctest.testmod()
, as I get errors about how "'OutStream' object has no attribute 'encoding'". To demonstrate the problem, I createddoctest_example.py
:Running this with
%run doctest_example.py
in the QtConsole results in the error message:The error doesn't seem to go away when toggling
%doctest_mode
.The text was updated successfully, but these errors were encountered: