Thread Rating:
  • 1 Vote(s) - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Simple Python Python Compiler
#1
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...'
Do what thou wilt shall be the whole of the Law. Love is the law, love under will.
.::The Rights of Man::.
Reply


Messages In This Thread
Simple Python Python Compiler - by Canoris - 06-10-2010, 04:42 PM
RE: Simple Python Python Compiler - by Canoris - 06-11-2010, 06:16 PM
RE: Simple Python Python Compiler - by Eve - 06-11-2010, 07:49 PM
RE: Simple Python Python Compiler - by Canoris - 06-11-2010, 08:17 PM
RE: Simple Python Python Compiler - by uber1337 - 06-14-2010, 11:16 AM
RE: Simple Python Python Compiler - by Canoris - 08-13-2010, 05:03 PM
RE: Simple Python Python Compiler - by Canoris - 08-13-2010, 05:37 PM
RE: Simple Python Python Compiler - by Nemmyy - 08-13-2010, 06:12 PM
RE: Simple Python Python Compiler - by Canoris - 08-13-2010, 06:26 PM
RE: Simple Python Python Compiler - by Canoris - 08-13-2010, 06:53 PM
RE: Simple Python Python Compiler - by Arеs - 11-01-2010, 09:06 AM
RE: Simple Python Python Compiler - by !LoL - 06-01-2011, 04:06 AM
RE: Simple Python Python Compiler - by Filefinder - 06-01-2011, 06:30 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  (★ Dяea Tutorials ★ )-==-[ DataBases in Python ]-==-(★Tutorial no.1★) Dяea 17 4,422 09-30-2019, 01:00 AM
Last Post: samsmith001
  help with simple python 2.6 task cardinalmanjune 1 894 09-30-2019, 12:59 AM
Last Post: samsmith001
  Python Help Dεlluzion 3 1,793 09-30-2019, 12:59 AM
Last Post: samsmith001
  Beginner's Python help!! proctortom 0 955 03-19-2014, 07:37 PM
Last Post: proctortom
  python help can you help me turn theses to pythons benwadee 0 904 08-13-2013, 03:43 AM
Last Post: benwadee

Forum Jump:


Users browsing this thread: 1 Guest(s)