Inserting-embedding some html data at the end of a .py file

Νίκος Γκρ33κ nikos.gr33k at gmail.com
Tue Mar 5 23:47:18 CET 2013


Thank you very much! This is what i was looking for and here is my code after receiving your help.
So, with the command you provided to me i can actually run the .py script ans save its output and then append from there!! Great!

Here is my code now!
====================================
	if htmlpage.endswith('.html'):
		f = open( "/home/nikos/public_html/" + htmlpage )
		htmldata = f.read()
	elif htmlpage.endswith('.py'):
		htmldata = subprocess.check_output( open( "/home/nikos/public_html/cgi-bin/" + htmlpage ) )
		
		
	counter = ''' <center><a href="mailto:support at superhost.gr"> <img src="/data/images/mail.png"> </a>
		      <center><table border=2 cellpadding=2 bgcolor=black>
				<td><font color=lime>Αριθμός Επισκεπτών</td>
				<td><a href="http://superhost.gr/?show=stats"><font color=cyan> %d </td>
		  ''' % data[0]
		
		
	template = htmldata + counter
	print ( template )
=======================================

But i'am getting this error:
<type 'exceptions.AttributeError'>: 'module' object has no attribute 'check_output' 

Why does it say it has no attribute?



More information about the Python-list mailing list