How to compile a python script to *.pyo

Peter Hansen peter at engcorp.com
Thu Apr 3 13:52:23 EST 2003


danny at iamlearning.com wrote:
> 
> > danny at iamlearning.com wrote:
> >>
> >> I want my users run *.pyo or *.pyc files instead of *.py.
> >
> > To expand on Jp's response a little: please explain why you think
> > you want this, so we can better understand the need that's driving it.
> > Maybe you are trying to do something you shouldn't be trying
> > to do, or maybe you're just going about it the wrong way.  What
> > makes you think doing what you are asking is a good thing?
> >
> > -Peter
> 
> I am working in test environment, and I didn't like testers alter my
> script (this happened to me). Basicly, I want my scripts are under control
> with my knowledge. If the problem come up, I know where to start
> troubleshooting.

Hmm... when we have a situation where someone does something inappropriate, 
we ask them not to, and explain why.  Generally they don't do it again...

Better than using individual .py[oc] files then would be to package
the program using py2exe, wouldn't it?  Are these people testing this
code itself, or using the code in the process of testing something 
else?  

If they're testing this code, then they're idiots and should
be fired if they go changing it on you. 

If they are using the code as a tool for testing something else,
you should probably have a proper release process for the tool, 
involving revision control, version numbers, and a nice little
packaging and installation sequence which prevents the whole issue
from happening in the first place.

Anyway, what makes you think that they won't do things like install
their own replacement .py files which do whatever they want, rather
than use your .pyc file, if they're such tricky types that they would
change your .py files on you?

(My advice: use education of the users to solve your problem, not 
fancy technical solutions.)

-Peter




More information about the Python-list mailing list