sys.builtins - python examples

Here are the examples of the python api sys.builtins taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.

1 Examples 7

3 View Complete Implementation : recipe-360875.py
Copyright MIT License
Author : ActiveState
def java(code, force=0):
	"""compile code snippet and return imported clast"""
	codelines=code.split(";")
	for line in codelines:
		if line.find("clast")!= -1:
			clastname=line[line.find("clast"):].split()[1]
			break
	try:
		oldcode=open(clastname+".java").readlines()
	except:
		oldcode=""
	print >> open(clastname+".java","w") ,code
	code=open(clastname+".java").readlines()
	if(oldcode!=code or force!=0):
		retcode,retout,reterr=jythonc.javac.compile([clastname+".java",])
		if retcode!=0:
			raise RuntimeError, reterr
	return sys.builtins["__import__"](clastname)