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.

8

u/[deleted] Jan 30 '20

Hey there friend, depending on how rebellious you're feeling you can download pycharm then just copy the folder onto your pc and it effectively runs like a portable app. I've been doing this for years.

https://stackoverflow.com/questions/4809214/is-there-an-easy-way-to-put-my-entire-installation-of-intellij-on-a-usb-stick/4809629#4809629

Hope this helps!

3

u/commenda Jan 31 '20

oh man, this is great. thank you