how to get rid of pyc files ?

Mike Kazantsev mk.fraggod at gmail.com
Sun May 24 09:07:27 EDT 2009


On Sun, 24 May 2009 15:01:51 +0200
Stef Mientki <stef.mientki at gmail.com> wrote:

> Moving my entire program section between windows and Ubuntu,
> sometimes causes problems, due to the existence of pyc-files
> (and probably because my program still has hard coded paths).
> 
> Now I want get rid of the pyc-files,
> so I wrote a py-script to remoce all pyc-files,
> but because it's run from the same program section,
> a few pyc files are recreated.
> 
> Is there a way to prevent generating pyc-files ?
> Or is there a way to redirect the generated pyc-files to a dedicated 
> location ?

Use a "-B" command-line option or "PYTHONDONTWRITEBYTECODE=x" env var.
You can put either "alias python='python -B'" or
"export PYTHONDONTWRITEBYTECODE=x" to your .bashrc/profile and forget
about .pyc/pyo forever.

> btw, What commandline switches are available for python ?
> (googling didn't give me any relevant hits )

You might be amazed how much insight "man python" and "python -h" can
yield ;)

-- 
Mike Kazantsev // fraggod.net
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 205 bytes
Desc: not available
URL: <http://mail.python.org/pipermail/python-list/attachments/20090524/d0a25c2e/attachment-0001.sig>


More information about the Python-list mailing list