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

Python Python Testing First Steps With Testing Writing and Running Doctests

Error when running doctest locally

I've tried running the doctest local, but keep on getting a SyntaxError

>>> python -m doctest -v dd_game.py
SyntaxError: invalid syntax

Anybody knows what's causing this?

[MOD: added ```python formatting -cf]

2 Answers

Chris Freeman
Chris Freeman
Treehouse Moderator 68,423 Points

You appear to be in the Python REPL. Instead, run doctest from the command or shell prompt.

Post back if you need more help. Good luck!!

Thanks for your answer, but I am running it from the Python 3.6.2. shell so that does not seem to be the reason. Any other thoughts?

Chris Freeman
Chris Freeman
Treehouse Moderator 68,423 Points

It needs to be run outside the Python shell. It should be run in a Windows command window or a Linux bash shell or other OS terminal window prompt.

Quit out of the REPL shell before running the command.

My apologies, must have misread it! After some difficulties, I was able to use it local. Thanks :)