r/pythontips • • Jan 30 '20

Python Command line

To catch any syntax errors before executing large time consuming scripts you can run the following from your command line

python3 -m py_compile my_script.py

38 Upvotes

8 comments sorted by

View all comments

13

u/gedon Jan 30 '20

An even better way is to use a decent IDE such as pycharm. You can run in debug mode or even just set break points and step through your code.

4

u/MonkHaus Jan 30 '20

But text editor + cli is more fun :/

3

u/commenda Jan 30 '20

also, at my office for example, that's all I have.

It took me 3 years to get even just nano+python3.6. So I'm not gonna bother to try and convince boneheaded IT to install Pycharm on my PC. So thanks for the suggestion OP.

2

u/MonkHaus Jan 30 '20

That made me laugh! And yeah I know the pain...