how to get rid of pyc files ?

Dave Angel davea at
Mon May 25 00:08:33 CEST 2009

pythoncurious at wrote:
> On May 24, 3:58 pm, John Machin <sjmac... at> wrote:
>> What problems? Like avoiding having to recompile your .py files makes
>> your app run too fast?
> There are real problems with this. I'm having similar problems when
> switching
> between Solaris and Windows.
> The code is in clearcase, which uses some sort of network file
> system.
> In our case, that means that I'll be accessing the same directories
> from both
> platforms, so .pyc-files from one platform will be visible when I run
> the
> code on the other platform.
> The .pyc-file will contain a string pointing to the file is was built
> from.
> The path to that file will be different under different platforms, so
> when the
> string is used, there will be error printouts.
> At least I think that's the problem, the error printouts contains
> paths that
> are only valid on the other platform.
> I don't have access to those computers atm, so I can't show the exact
> message.
> The only solution I've seen is to make sure to clean up the .pyc files
> each
> time I switch platform.
Is Clearcase still around?  I hope it works better than it did in 1992.

Somebody else has already pointed out that you can tell Python not to 
create those files (during your development stages).

But if that won't work for some reason, perhaps you can do something 
with symbolic links.  I remember that RCS, for example, required that 
the archives be located in a directory immediately below the one with 
the sources.  So in order to share those archives, you made the 
subdirectory actually a link to a common network location.

Your case would seem to be the opposite.  But I don't know enough about 
the current state of either Solaris or Clearcase to know the best answer.

Perhaps Clearcase supports some form of "exclusion" parameter, wherein 
you say not to do version control on files with certain patterns, like .pyc

More information about the Python-list mailing list