The Author Online Book Forums are Moving

The Author Online Book Forums will soon redirect to Manning's liveBook and liveVideo. All book forum content will migrate to liveBook's discussion forum and all video forum content will migrate to liveVideo. Log in to liveBook or liveVideo with your Manning credentials to join the discussion!

Thank you for your engagement in the AoF over the years! We look forward to offering you a more enhanced forum experience.

import-bot (20211) [Avatar] Offline
#1
Re: command line options
[Originally posted by daryl harms]

> I would like to like to run the scripts to check for syntax errors without
> actually executing the script. (in Perl, I do something like "perl -c
> filename"smilie
> Thanks,
> Med.

Hi Med,

I'm not aware of an equivalent in Python to "perl -c". The interpreter will
first compile creating a .pyc file (if the source has changed) and then
execute. I don't know of a way to get it to just create the .pyc file only.
You can catch some syntax errors by opening your script in an IDE (like IDLE)
and seeing if it parses and highlights the code properly.

There was also a project a while back to create a "lint" for python (more
specifically to add type checking rather than just syntax checking). You can
find it at:
http://www.dotfunk.com/projects/pylint

I have never looked at it so can't vouch for whether it works or would be
useful to you though.

Daryl
import-bot (20211) [Avatar] Offline
#2
[Originally posted by najme001]

I would like to like to run the scripts to check for syntax errors without
actually executing the script. (in Perl, I do something like "perl -c
filename")
Thanks,
Med.