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 trialIvars Jaundzeikars
8,224 PointsHow do you get style errors displayed on Workspace console?
For example, for me python badpep8.py simply runs, it doesn't display any errors so I was wondering is it like some secret key combination you're pressing or something in the settings that let's you see python style errors pointed for you when running the script?
Yeah, it just gives me output and that's all.
3 Answers
Kenneth Love
Treehouse Guest TeacherYou can also run pep8 <myscript.py>
on the command line (outside of the Python shell) and you'll see syntax errors.
Ivars Jaundzeikars
8,224 PointsI actually managed to solve this myself. You have to use
import pep8
checker = pep8.Checker('badpep8.py')
checker.check_all()
in code to like see it... Thx for checking, tho
SOLVED
Andrei Fecioru
15,059 PointsAn alternative would be to use a PEP8-aware text editor or IDE (Integrated Development Editor). In such an editor, all the deviations from the PEP8 recommendations are highlighted and easy to spot and fix. Plus, the IDE may also provide an auto-fix option so you don't have to apply the modifications manually.
Personally, I am a big fan of the JetBrains family of products (I have no affiliation with those guys, I'm just a happy customer). You can use either IntelliJ Ultimate and install the python plugin (this option costs some money, but in my case, my employer payed for it) or you can use the PyCharm sub-product which I now see has a free community edition. (https://www.jetbrains.com/pycharm/download/)
Another advantage of using an IDE is that you have access to the debugger directly from you editor. You can visually inspect the breakpoints and stackframe, step through the code and query variables etc. from the IDE itself.
Ivars Jaundzeikars
8,224 PointsThat's, my friends, is called technology! Thx for the insight, sounds like a good use of software indeed.
I'd give you best answer, but I wouldn't feel good taking it away from Kenneth)
Ivars Jaundzeikars
8,224 PointsIvars Jaundzeikars
8,224 Pointsthat's fair, thx for tip