Why the file mode of .pyc files has x?

Cameron Simpson cs at zip.com.au
Mon Sep 28 03:01:40 EDT 2009


On 26Sep2009 10:24, Peng Yu <pengyu.ut at gmail.com> wrote:
| > [steve at sylar test]$ ls -l
| > total 16
| > -rw-rw-r-- 1 steve steve  6 2009-09-26 23:06 test.py
| > -rw-rw-r-- 1 steve steve 94 2009-09-26 23:08 test.pyc
| >
| > Have you checked the umask of your system?
| 
| Here are my test case. If the .py file has the 'x' mode, the
| corresponding .pyc file also has the 'x' mode after the .py file is
| imported.

Yes, I see this too.

| pengy at selenium:~/test/python/pyc_mode$ umask
| 0077
| pengy at selenium:~/test/python/pyc_mode$ ll
| total 8
| -rw------- 1 pengy lilab  29 2009-09-26 10:10:45 main.py
| -rwx------ 1 pengy lilab 106 2009-09-26 10:19:17 test.py
[...]
| pengy at selenium:~/test/python/pyc_mode$ python main.py
| in_test_func
| pengy at selenium:~/test/python/pyc_mode$ ll
| total 12
| -rw------- 1 pengy lilab  29 2009-09-26 10:10:45 main.py
| -rwx------ 1 pengy lilab 106 2009-09-26 10:19:17 test.py
| -rwx------ 1 pengy lilab 339 2009-09-26 10:20:39 test.pyc

This happens for me with python 2.6 x86_64 on gentoo.

You're not alone.
-- 
Cameron Simpson <cs at zip.com.au> DoD#743
http://www.cskk.ezoshosting.com/cs/

Reaching consensus in a group often is confused with finding the right
answer. - Norman Maier



More information about the Python-list mailing list