Only Bytecode, No .py Files
ameyer2 at yahoo.com
Fri Jul 29 17:06:17 CEST 2011
On 07/26/2011 11:19 AM, Eldon Ziegler wrote:
> Is there a way to have the Python processor look only for bytecode
> files, not .py files? We are seeing huge numbers of Linux audit messages
> on production system on which only bytecode files are stored. The audit
> subsystem is recording each open failure.
> Eldon Ziegler
Here are two suggestions:
1. Put a dummy python file in the directory that does very little,
perhaps something like:
print("%s: You should not be seeing this" % sys.argv)
Give it the name of one of the .pyc, e.g., if foo.pyc, then foo.py.
Give the bytecode file a later date, e.g., "touch foo.pyc" (assuming you
can do that without messing up other aspects of your system.)
If that works, then copy the dummy file to each of the other required
.py names in the directory. You'll then have to touch *.pyc to ensure
that the pyc's have later dates. After that, you won't have to do
anything when you replace a .pyc file. When you add a new .pyc you'll
need to do the copy and touch again.
2. Use a log truncator to truncate the audit log.
I don't remember the name of one at the moment, but I believe there is
at least one open source program that will monitor named files and
truncate them from the beginning to a fixed maximum size.
I don't like this method as much as the first because it might result in
something important being truncated.
More information about the Python-list