python - Why is the "file" command get confused on .py files? -


i have several python modules i've written. randomly, used file on directory, , surprised saw. here's resulting count of thought files were:

  1 ascii java program text, long lines   1 /bin/env python script text executable   1 python script text executable   2 ascii c++ program text   4 ascii english text  18 ascii java program text 

that's strange! idea what's going on or why seems think python modules java files?

i'm using centos 5.2.

edit question more geared towards curiosity on why non-java , non-c++ program file being classified such. don't expect file perfect, surprised on choices being made. have guessed give , text file rather making incorrect inferences.

from file man page

file tests each argument in attempt classify it. there 3 sets of tests, performed in order: filesystem tests, magic number tests, , language tests. first test succeeds causes file type printed.

my guess of files happen match tests different languages , incorrectly identify file.

also, file intended binary files, bugs section indicates.

file uses several algorithms favor speed on accuracy, can misled contents of text files.

the support text files (primarily programming languages) simplistic, inefficient , requires recompilation update.


Comments

Popular posts from this blog

linux - Mailx and Gmail nss config dir -

c# - Is it possible to remove an existing registration from Autofac container builder? -

php - Mysql PK and FK char(36) vs int(10) -