Re: how to get rid of pyc files ?

Discussion in 'Python' started by Mike Kazantsev, May 24, 2009.

  1. On Sun, 24 May 2009 15:01:51 +0200
    Stef Mientki <> 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

    -----BEGIN PGP SIGNATURE-----
    Version: GnuPG v2.0.11 (GNU/Linux)

    iEYEARECAAYFAkoZRpMACgkQASbOZpzyXnEuHACfXg9JMpPNvPxRB8jbk6xUX2mJ
    c58AoMoTTThK5vCWAAv+kQtL6kuMFmdL
    =TckD
    -----END PGP SIGNATURE-----
    Mike Kazantsev, May 24, 2009
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Rim
    Replies:
    8
    Views:
    939
  2. Ladvánszky Károly

    pyc files

    Ladvánszky Károly, Feb 3, 2004, in forum: Python
    Replies:
    3
    Views:
    392
    Rene Pijlman
    Feb 3, 2004
  3. =?Utf-8?B?Qm9yaXMgWWVsdHNpbg==?=

    Single DLL - How to get rid of ASPX files?

    =?Utf-8?B?Qm9yaXMgWWVsdHNpbg==?=, Oct 25, 2006, in forum: ASP .Net
    Replies:
    18
    Views:
    748
    Walter Wang [MSFT]
    Nov 6, 2006
  4. Stef Mientki

    how to get rid of pyc files ?

    Stef Mientki, May 24, 2009, in forum: Python
    Replies:
    12
    Views:
    964
    Gabriel Genellina
    Jun 4, 2009
  5. Mircescu Andrei
    Replies:
    3
    Views:
    78
    Mircescu Andrei
    Feb 20, 2014
Loading...

Share This Page