Any way to not create .pyc files?
Peter Hansen
peter at engcorp.com
Thu Jun 9 14:25:07 EDT 2005
Steve Holden wrote:
> Lonnie Princehouse wrote:
>> If these .pyc files exist, they appear to cause problems when other
>> users' Python interpreters use them instead of the .py files. (I know,
>> they *should* work, but they don't). This may have something to do
>> with the fact that all of these users (on Windows) have the network
>> drive mapped to arbitrary drive letters. I don't know.
That won't be the reason.
> You might also expect problems if one user was using python 2.2 and
> another was using 2.4, since each version requires its own format for
> the .pyc file, and they might conflict. Ulitmately it sounds like a
> permissions problem.
> It would be *much* more sensible to find the underlying cause of the
> problems and actually fix them :-)
I agree with Steve, and want to add to what he's given you.
The only reason a .pyc file gets written is if the magic number inside
doesn't match the one expected by your version of python, or if the
timestamp that is stored inside doesn't match the timestamp of the .py
file from which it was created. As far as I know, if both these things
are true (and if the file is actually readable) then the .pyc file is
loaded and the .py is ignored, and no new .pyc file is written.
I suggest you pick two users who have the same version of python and
test whether your .pyc files are written again and again. If they are
not, then start looking for the "bad" user who probably has an older
version of python. If they are written over and over, then Steve is
probably correct about a permissions issue.
HTH
-Peter
More information about the Python-list
mailing list