Path: csiph.com!usenet.pasdenom.info!gegeweb.org!newsfeed.kamp.net!newsfeed.kamp.net!newsfeed.freenet.ag!news2.euro.net!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.001 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'elif': 0.04; 'output': 0.04; 'attribute': 0.05; 'error:': 0.05; 'much!': 0.05; 'append': 0.07; 'subject:file': 0.07; 'python': 0.09; "'''": 0.09; 'template': 0.11; '2.7': 0.13; '.py': 0.16; 'ans': 0.16; 'attribute?': 0.16; 'f.read()': 0.16; 'great!': 0.16; 'received :your-server.de': 0.16; 'wrote:': 0.17; 'skip:" 30': 0.20; 'help.': 0.22; 'command': 0.24; 'script': 0.24; 'header:In-Reply- To:1': 0.25; 'header:User-Agent:1': 0.26; 'skip:" 20': 0.26; 'lines': 0.28; 'run': 0.28; '+0100,': 0.29; 'subject:end': 0.29; 'subject:some': 0.29; "skip:' 10": 0.30; 'code': 0.31; "skip:' 20": 0.32; 'print': 0.32; 'getting': 0.33; 'subject: .': 0.33; 'subject:data': 0.33; 'to:addr:python-list': 0.33; 'version': 0.34; 'along': 0.35; 'so,': 0.35; 'but': 0.36; 'thank': 0.36; 'does': 0.37; 'why': 0.37; 'subject:: ': 0.38; 'object': 0.38; 'to:addr:python.org': 0.39; 'subject:-': 0.40; 'your': 0.60; 'save': 0.61; 'more': 0.63; 'skip:= 30': 0.64; 'here': 0.65; '8bit%:100': 0.70; '2013': 0.84; 'url:show': 0.84 Content-Type: text/plain; charset=utf-8; format=flowed; delsp=yes To: python-list@python.org Subject: Re: Inserting-embedding some html data at the end of a .py file References: <7e0a8562-9a48-4f5a-804d-3751733288f0@googlegroups.com> <009ab803-6269-453b-bff1-0c58a6db358d@googlegroups.com> Date: Wed, 06 Mar 2013 00:19:03 +0100 MIME-Version: 1.0 Content-Transfer-Encoding: Quoted-Printable From: "Michael Ross" In-Reply-To: <009ab803-6269-453b-bff1-0c58a6db358d@googlegroups.com> User-Agent: Opera Mail/12.14 (Win32) X-Authenticated-Sender: gmx@ross.cx X-Virus-Scanned: Clear (ClamAV 0.97.6/16788/Tue Mar 5 23:07:27 2013) X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 65 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1362525552 news.xs4all.nl 6966 [2001:888:2000:d::a6]:35254 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:40578 On Tue, 05 Mar 2013 23:47:18 +0100, =CE=9D=CE=AF=CE=BA=CE=BF=CF=82 =CE=93= =CE=BA=CF=8133=CE=BA = wrote: > Thank you very much! This is what i was looking for and here is my cod= e = > 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! > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > if htmlpage.endswith('.html'): > f =3D open( "/home/nikos/public_html/" + htmlpage ) > htmldata =3D f.read() > elif htmlpage.endswith('.py'): > htmldata =3D subprocess.check_output( open( = > "/home/nikos/public_html/cgi-bin/" + htmlpage ) ) > = > = > counter =3D '''
src=3D"/data/images/mail.png"> >
> > > ''' % data[0] > = > = > template =3D htmldata + counter > print ( template ) > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > > But i'am getting this error: > : 'module' object has no attribute = > 'check_output' > > Why does it say it has no attribute? Python version < 2.7 ? And it's more along the lines of subprocess.check_output( '/home/nikos/.../' + htmlpage ) without "open". Or even subprocess.check_output( [ '/your/python/interpreter', '/home/nikos/...= ' = ] )
=CE=91=CF=81=CE=B9=CE=B8=CE=BC=CF=8C=CF=82 = =CE=95=CF=80=CE=B9=CF=83=CE=BA=CE=B5=CF=80=CF=84=CF=8E=CE=BD %d = >