pychecker checks files by executing them ??

Bengt Richter bokr at oz.net
Tue Jun 3 17:51:23 EDT 2003


On Tue, 03 Jun 2003 19:50:13 +0200, Just <just at xs4all.nl> wrote:

>In article <u1b7xkwr.fsf at python.net>,
> Thomas Heller <theller at python.net> wrote:
>
>> Axel Kowald <kowald at molgen.mpg.de> writes:
>> 
>> > I got pychecker and installed it on my w2k machine as described. It
>> > also seems to work, but when I do:
>> > 
>> > pychecker myFile.py   it actually "executes"  myFile.py, while
>> > checking it. Is this the correct behaviour??
>>
>> > Obviously I would like to check my scripts without executing them. Any
>> > idea what's going on ?
>> > 
>> pychecker imports them, not executes them.
>
>Hm, I don't understand how you can make that distinction: if you import 
>a module, it gets executed.
Yes. IWT that deserves a security warning someplace in pychecker - maybe even
a default prompted are-you-sure that can optionally but only explicitly be
made quiet.
>
>> Protect the main function or
>> what it is in your case by the usual 'if __name__ == "__main__":' idiom
>> (which you should do anyway IMO), and you are fine.
>
>True. Yet it would be far better if PyChecker would analyze the compiled 
>byte code instead of executing it. The same goes for pydoc btw.
>
Bad news. I would want a documenter to be a safe way to get a first look
at something untrusted. Sheesh. Thanks for the wakeup ;-/

Regards,
Bengt Richter




More information about the Python-list mailing list