I want to compile py files to com files.

Please help me.


Python is an interpreter and only compiles to it's internal byte code.

Packagers like py2exe are available that package the byte code and the interpreter (dll) into a self-extracting executable file.

Thanks a lot!

Question: Can I create OS with python?

Not ideal for that but for example there is pypy (see http://pypy.org) python just-in-time compiler (not many modules included), which is quite heavy class of programming. If you want exe to speed up your program check that (I found however that file operations are quite slow in Windows with that) or like me use the psyco module to do just-in-time compiling (specialized compiler it calls itself). That is not available for Python 3, so I stay with Python 2.6 for now.

The module psyco compiles to 386 machine code rather than byte code. It speeds things up a little for the Python interpreter.

To my knowledge two complete OS have been written using mostly Python, both of them are less than ideal and are used for research purposes only. Python is a high level language and has not been designed for such a low level task!