Support Forums
Simple Python Python Compiler - Printable Version

+- Support Forums (https://www.supportforums.net)
+-- Forum: Categories (https://www.supportforums.net/forumdisplay.php?fid=87)
+--- Forum: Coding Support Forums (https://www.supportforums.net/forumdisplay.php?fid=18)
+---- Forum: Python Programming Language (https://www.supportforums.net/forumdisplay.php?fid=32)
+---- Thread: Simple Python Python Compiler (/showthread.php?tid=7730)

Pages: 1 2 3


Simple Python Python Compiler - Canoris - 06-10-2010

Code:
#81ack Interface (C) Under the LGPL license v3 <http://www.gnu.org/licenses/lgpl.txt>

import sys

try:
    import py_compile
except ImportError:
    print 'ERROR: py_compile module not found...'
    sys.exit(0)
else:
    print 'Imported module py_compile...'
try:
    import compileall
except ImportError:
    print 'ERROR: comileall module not found...'
    sys.exit(0)
else:
    print 'Imported module compileall...'

ifd = raw_input('Compile all?{y|n}[n]')
if ifd == 'y' or ifd == 'Y':
    p = raw_input('Directory: ')
    if p != '':
        compileall.compile_dir(p)
        sys.exit(0)
    else:
        print 'ERROR: please specify a directory...'
        sys.exit(0)

p = raw_input('File: ')
try:
    py_compile.compile(p)
except IOError:
    print 'ERROR: file not specified or directory does not exist'
    sys.exit(0)
else:
    print p+' compiled...'



RE: Simple Python Python Compiler - Canoris - 06-11-2010

I just provided a 7 day dl link. Be happy to if people find the program slightly resourceful. : /
pycompile.pyc


RE: Simple Python Python Compiler - Eve - 06-11-2010

Thank you for providing this. Perhaps explain its functions for people who might be unfamiliar with coding?


RE: Simple Python Python Compiler - Canoris - 06-11-2010

(06-11-2010, 07:49 PM)Eve Wrote: Thank you for providing this. Perhaps explain its functions for people who might be unfamiliar with coding?
To be honest, it really has no concern for those who do not know how to code. Not being rude, but it's truly designed for the convenience of compiling python source. Oui

BTW, Congrats on becoming a Moderator.


RE: Simple Python Python Compiler - uber1337 - 06-14-2010

Thank you, this is useful, @ Eve: as he said this script is useless if you don't know how to code, it compiles python scripts so they run faster.


RE: Simple Python Python Compiler - Daniel Faraday - 08-13-2010

There is already a module that allows you to compile python files.
So what's the purpose of creating another one?


RE: Simple Python Python Compiler - Canoris - 08-13-2010

(08-13-2010, 03:28 PM)Road Kamelot Wrote: There is already a module that allows you to compile python files.
So what's the purpose of creating another one?
No crap bud. This is for ease of use; nothing more or nothing less.


RE: Simple Python Python Compiler - Daniel Faraday - 08-13-2010

I fail to see how a new module would be easier than just using the one that comes with python.


RE: Simple Python Python Compiler - Canoris - 08-13-2010

(08-13-2010, 05:34 PM)Road Kamelot Wrote: I fail to see how a new module would be easier than just using the one that comes with python.
Well, why don't you time each method. See which one is faster.


RE: Simple Python Python Compiler - Daniel Faraday - 08-13-2010

In Linux I can enter one line and it will compile a python file to a .pyc
I'm sure there is something like that for windows as well.