Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #40529 > unrolled thread

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

Started byΝίκος Γκρ33κ <nikos.gr33k@gmail.com>
First post2013-03-05 06:35 -0800
Last post2013-03-05 15:39 -0800
Articles 20 on this page of 56 — 9 participants

Back to article view | Back to comp.lang.python


Contents

  Inserting-embedding some html data at the end of a .py file Νίκος Γκρ33κ <nikos.gr33k@gmail.com> - 2013-03-05 06:35 -0800
    Re: Inserting-embedding some html data at the end of a .py file Νίκος Γκρ33κ <nikos.gr33k@gmail.com> - 2013-03-05 09:11 -0800
      Re: Inserting-embedding some html data at the end of a .py file Mark Lawrence <breamoreboy@yahoo.co.uk> - 2013-03-05 17:19 +0000
      Re: Inserting-embedding some html data at the end of a .py file Joel Goldstick <joel.goldstick@gmail.com> - 2013-03-05 12:25 -0500
    Re: Inserting-embedding some html data at the end of a .py file Νίκος Γκρ33κ <nikos.gr33k@gmail.com> - 2013-03-05 09:39 -0800
      Re: Inserting-embedding some html data at the end of a .py file Joel Goldstick <joel.goldstick@gmail.com> - 2013-03-05 12:45 -0500
        Re: Inserting-embedding some html data at the end of a .py file Νίκος Γκρ33κ <nikos.gr33k@gmail.com> - 2013-03-05 09:49 -0800
          Re: Inserting-embedding some html data at the end of a .py file Dave Angel <davea@davea.name> - 2013-03-05 13:18 -0500
            Re: Inserting-embedding some html data at the end of a .py file Νίκος Γκρ33κ <nikos.gr33k@gmail.com> - 2013-03-05 10:53 -0800
              Re: Inserting-embedding some html data at the end of a .py file Joel Goldstick <joel.goldstick@gmail.com> - 2013-03-05 14:33 -0500
              Re: Inserting-embedding some html data at the end of a .py file Dave Angel <davea@davea.name> - 2013-03-05 14:48 -0500
            Re: Inserting-embedding some html data at the end of a .py file Νίκος Γκρ33κ <nikos.gr33k@gmail.com> - 2013-03-05 10:53 -0800
        Re: Inserting-embedding some html data at the end of a .py file Νίκος Γκρ33κ <nikos.gr33k@gmail.com> - 2013-03-05 09:49 -0800
      Re: Inserting-embedding some html data at the end of a .py file Mark Lawrence <breamoreboy@yahoo.co.uk> - 2013-03-05 17:53 +0000
      Re: Inserting-embedding some html data at the end of a .py file Roland Koebler <r.koebler@yahoo.de> - 2013-03-06 10:00 +0100
    Re: Inserting-embedding some html data at the end of a .py file Νίκος Γκρ33κ <nikos.gr33k@gmail.com> - 2013-03-05 12:04 -0800
      Re: Inserting-embedding some html data at the end of a .py file Dave Angel <d@davea.name> - 2013-03-05 16:02 -0500
        Re: Inserting-embedding some html data at the end of a .py file Νίκος Γκρ33κ <nikos.gr33k@gmail.com> - 2013-03-05 14:49 -0800
        Re: Inserting-embedding some html data at the end of a .py file Νίκος Γκρ33κ <nikos.gr33k@gmail.com> - 2013-03-05 14:49 -0800
      Re: Inserting-embedding some html data at the end of a .py file "Michael Ross" <gmx@ross.cx> - 2013-03-05 22:29 +0100
    Re: Inserting-embedding some html data at the end of a .py file Νίκος Γκρ33κ <nikos.gr33k@gmail.com> - 2013-03-05 14:47 -0800
      Re: Inserting-embedding some html data at the end of a .py file "Michael Ross" <gmx@ross.cx> - 2013-03-06 00:19 +0100
        Re: Inserting-embedding some html data at the end of a .py file Νίκος Γκρ33κ <nikos.gr33k@gmail.com> - 2013-03-05 15:39 -0800
          Re: Inserting-embedding some html data at the end of a .py file "Michael Ross" <gmx@ross.cx> - 2013-03-06 01:06 +0100
            Re: Inserting-embedding some html data at the end of a .py file Νίκος Γκρ33κ <nikos.gr33k@gmail.com> - 2013-03-05 22:12 -0800
            Re: Inserting-embedding some html data at the end of a .py file Νίκος Γκρ33κ <nikos.gr33k@gmail.com> - 2013-03-05 22:12 -0800
            Re: Inserting-embedding some html data at the end of a .py file Νίκος Γκρ33κ <nikos.gr33k@gmail.com> - 2013-03-05 23:48 -0800
            Re: Inserting-embedding some html data at the end of a .py file Νίκος Γκρ33κ <nikos.gr33k@gmail.com> - 2013-03-05 23:48 -0800
            Re: Inserting-embedding some html data at the end of a .py file Νίκος Γκρ33κ <nikos.gr33k@gmail.com> - 2013-03-06 15:18 -0800
              Re: Inserting-embedding some html data at the end of a .py file "Michael Ross" <gmx@ross.cx> - 2013-03-07 01:25 +0100
                Re: Inserting-embedding some html data at the end of a .py file Νίκος Γκρ33κ <nikos.gr33k@gmail.com> - 2013-03-06 22:35 -0800
                  Re: Inserting-embedding some html data at the end of a .py file Roland Koebler <r.koebler@yahoo.de> - 2013-03-07 09:58 +0100
                    Re: Inserting-embedding some html data at the end of a .py file Νίκος Γκρ33κ <nikos.gr33k@gmail.com> - 2013-03-07 01:05 -0800
                      Re: Inserting-embedding some html data at the end of a .py file Lele Gaifax <lele@metapensiero.it> - 2013-03-07 10:22 +0100
                        Re: Inserting-embedding some html data at the end of a .py file Νίκος Γκρ33κ <nikos.gr33k@gmail.com> - 2013-03-07 01:28 -0800
                          Re: Inserting-embedding some html data at the end of a .py file Lele Gaifax <lele@metapensiero.it> - 2013-03-07 10:50 +0100
                            Re: Inserting-embedding some html data at the end of a .py file Νίκος Γκρ33κ <nikos.gr33k@gmail.com> - 2013-03-07 01:55 -0800
                            Re: Inserting-embedding some html data at the end of a .py file Νίκος Γκρ33κ <nikos.gr33k@gmail.com> - 2013-03-07 01:55 -0800
                          Re: Inserting-embedding some html data at the end of a .py file Chris Angelico <rosuav@gmail.com> - 2013-03-07 21:19 +1100
                            Re: Inserting-embedding some html data at the end of a .py file Νίκος Γκρ33κ <nikos.gr33k@gmail.com> - 2013-03-07 02:34 -0800
                            Re: Inserting-embedding some html data at the end of a .py file Νίκος Γκρ33κ <nikos.gr33k@gmail.com> - 2013-03-07 02:34 -0800
                              Re: Inserting-embedding some html data at the end of a .py file Νίκος Γκρ33κ <nikos.gr33k@gmail.com> - 2013-03-07 03:51 -0800
                              Re: Inserting-embedding some html data at the end of a .py file Νίκος Γκρ33κ <nikos.gr33k@gmail.com> - 2013-03-07 03:51 -0800
                        Re: Inserting-embedding some html data at the end of a .py file Νίκος Γκρ33κ <nikos.gr33k@gmail.com> - 2013-03-07 01:28 -0800
                        Re: Inserting-embedding some html data at the end of a .py file Νίκος Γκρ33κ <nikos.gr33k@gmail.com> - 2013-03-07 02:09 -0800
                          Re: Inserting-embedding some html data at the end of a .py file Joel Goldstick <joel.goldstick@gmail.com> - 2013-03-07 05:28 -0500
                            Re: Inserting-embedding some html data at the end of a .py file Νίκος Γκρ33κ <nikos.gr33k@gmail.com> - 2013-03-07 04:06 -0800
                              Re: Inserting-embedding some html data at the end of a .py file Chris Angelico <rosuav@gmail.com> - 2013-03-07 23:17 +1100
                            Re: Inserting-embedding some html data at the end of a .py file Νίκος Γκρ33κ <nikos.gr33k@gmail.com> - 2013-03-07 04:06 -0800
                        Re: Inserting-embedding some html data at the end of a .py file Νίκος Γκρ33κ <nikos.gr33k@gmail.com> - 2013-03-07 02:09 -0800
                    Re: Inserting-embedding some html data at the end of a .py file Νίκος Γκρ33κ <nikos.gr33k@gmail.com> - 2013-03-07 01:05 -0800
                Re: Inserting-embedding some html data at the end of a .py file Νίκος Γκρ33κ <nikos.gr33k@gmail.com> - 2013-03-06 22:35 -0800
                Re: Inserting-embedding some html data at the end of a .py file Νίκος Γκρ33κ <nikos.gr33k@gmail.com> - 2013-03-06 22:42 -0800
                Re: Inserting-embedding some html data at the end of a .py file Νίκος Γκρ33κ <nikos.gr33k@gmail.com> - 2013-03-06 22:42 -0800
            Re: Inserting-embedding some html data at the end of a .py file Νίκος Γκρ33κ <nikos.gr33k@gmail.com> - 2013-03-06 15:18 -0800
        Re: Inserting-embedding some html data at the end of a .py file Νίκος Γκρ33κ <nikos.gr33k@gmail.com> - 2013-03-05 15:39 -0800

Page 2 of 3 — ← Prev page 1 [2] 3  Next page →


#40573

FromΝίκος Γκρ33κ <nikos.gr33k@gmail.com>
Date2013-03-05 14:47 -0800
Message-ID<009ab803-6269-453b-bff1-0c58a6db358d@googlegroups.com>
In reply to#40529
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@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?

[toc] | [prev] | [next] | [standalone]


#40578

From"Michael Ross" <gmx@ross.cx>
Date2013-03-06 00:19 +0100
Message-ID<mailman.2914.1362525552.2939.python-list@python.org>
In reply to#40573
On Tue, 05 Mar 2013 23:47:18 +0100, Νίκος Γκρ33κ <nikos.gr33k@gmail.com>  
wrote:

> 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@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?

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/...'  
] )

[toc] | [prev] | [next] | [standalone]


#40581

FromΝίκος Γκρ33κ <nikos.gr33k@gmail.com>
Date2013-03-05 15:39 -0800
Message-ID<0d58f312-9259-407d-b47b-80b88cf9a82c@googlegroups.com>
In reply to#40578
htmldata = subprocess.check_output( '/home/nikos/public_html/cgi-bin/' + htmlpage )

htmldata = subprocess.check_output( ['/usr/bin/python', '/home/nikos/public_html/cgi-bin/' + htmlpage] )

Both of the above statemnts fail i'am afraid with the same error message.

[toc] | [prev] | [next] | [standalone]


#40585

From"Michael Ross" <gmx@ross.cx>
Date2013-03-06 01:06 +0100
Message-ID<mailman.2917.1362528402.2939.python-list@python.org>
In reply to#40581
On Wed, 06 Mar 2013 00:39:31 +0100, Νίκος Γκρ33κ <nikos.gr33k@gmail.com>  
wrote:

> htmldata = subprocess.check_output( '/home/nikos/public_html/cgi-bin/' +  
> htmlpage )
>
> htmldata = subprocess.check_output( ['/usr/bin/python',  
> '/home/nikos/public_html/cgi-bin/' + htmlpage] )
>
> Both of the above statemnts fail i'am afraid with the same error message.


check_output is available as of Python 2.7

I guess you are still on version 2.6 ?

[toc] | [prev] | [next] | [standalone]


#40607

FromΝίκος Γκρ33κ <nikos.gr33k@gmail.com>
Date2013-03-05 22:12 -0800
Message-ID<895c48df-e965-40c3-a69c-cfb2f5fc7a3e@googlegroups.com>
In reply to#40585
Τη Τετάρτη, 6 Μαρτίου 2013 2:06:33 π.μ. UTC+2, ο χρήστης Michael Ross έγραψε:
> On Wed, 06 Mar 2013 00:39:31 +0100, Νίκος Γκρ33κ   
> 
> wrote:
> 
> 
> 
> > htmldata = subprocess.check_output( '/home/nikos/public_html/cgi-bin/' +  
> 
> > htmlpage )
> 
> >
> 
> > htmldata = subprocess.check_output( ['/usr/bin/python',  
> 
> > '/home/nikos/public_html/cgi-bin/' + htmlpage] )
> 
> >
> 
> > Both of the above statemnts fail i'am afraid with the same error message.

> check_output is available as of Python 2.7 
> I guess you are still on version 2.6 ?

Actually i'am runnign myu cgi script on my hostgator remote web hosting.
How dod i check the version of python the server uses?

[toc] | [prev] | [next] | [standalone]


#40608

FromΝίκος Γκρ33κ <nikos.gr33k@gmail.com>
Date2013-03-05 22:12 -0800
Message-ID<mailman.2926.1362550330.2939.python-list@python.org>
In reply to#40585
Τη Τετάρτη, 6 Μαρτίου 2013 2:06:33 π.μ. UTC+2, ο χρήστης Michael Ross έγραψε:
> On Wed, 06 Mar 2013 00:39:31 +0100, Νίκος Γκρ33κ   
> 
> wrote:
> 
> 
> 
> > htmldata = subprocess.check_output( '/home/nikos/public_html/cgi-bin/' +  
> 
> > htmlpage )
> 
> >
> 
> > htmldata = subprocess.check_output( ['/usr/bin/python',  
> 
> > '/home/nikos/public_html/cgi-bin/' + htmlpage] )
> 
> >
> 
> > Both of the above statemnts fail i'am afraid with the same error message.

> check_output is available as of Python 2.7 
> I guess you are still on version 2.6 ?

Actually i'am runnign myu cgi script on my hostgator remote web hosting.
How dod i check the version of python the server uses?

[toc] | [prev] | [next] | [standalone]


#40610

FromΝίκος Γκρ33κ <nikos.gr33k@gmail.com>
Date2013-03-05 23:48 -0800
Message-ID<daf43e3a-8440-42f7-b91d-f9a4accb8cd0@googlegroups.com>
In reply to#40585
Τη Τετάρτη, 6 Μαρτίου 2013 2:06:33 π.μ. UTC+2, ο χρήστης Michael Ross έγραψε:

> check_output is available as of Python 2.7
> 
> 
> 
> I guess you are still on version 2.6 ?

Indeed!
i just checked it's Python 2.6.6: /usr/bin/python and i have asked the linxu admins @ hostgator.com to update python.

I trust when they update to v2.7 the script will automatically work!

[toc] | [prev] | [next] | [standalone]


#40611

FromΝίκος Γκρ33κ <nikos.gr33k@gmail.com>
Date2013-03-05 23:48 -0800
Message-ID<mailman.2927.1362556101.2939.python-list@python.org>
In reply to#40585
Τη Τετάρτη, 6 Μαρτίου 2013 2:06:33 π.μ. UTC+2, ο χρήστης Michael Ross έγραψε:

> check_output is available as of Python 2.7
> 
> 
> 
> I guess you are still on version 2.6 ?

Indeed!
i just checked it's Python 2.6.6: /usr/bin/python and i have asked the linxu admins @ hostgator.com to update python.

I trust when they update to v2.7 the script will automatically work!

[toc] | [prev] | [next] | [standalone]


#40666

FromΝίκος Γκρ33κ <nikos.gr33k@gmail.com>
Date2013-03-06 15:18 -0800
Message-ID<5bfc6644-388f-4469-a591-63fb8070faa2@googlegroups.com>
In reply to#40585
Τη Τετάρτη, 6 Μαρτίου 2013 2:06:33 π.μ. UTC+2, ο χρήστης Michael Ross έγραψε:

> check_output is available as of Python 2.7
> I guess you are still on version 2.6 ?


I can access each of these from my jailed shell user account without issue, and especially i try /usr/bin/python3

nikos@superhost.gr [~]# /usr/bin/python -V
Python 2.6.6

nikos@superhost.gr [~]# /opt/python3/bin/python3 -V
Python 3.2.3

nikos@superhost.gr [~]# /usr/bin/python3 -V
Python 3.2.3 


Problem is that when i change my shebang constructor to #!/sur/bin/python3 my '/cgi-bin/metrites.py' python cgi scripts produces an internal server error while with #!/sur/bin/python the script works.

Any ideas as to why? I can post ocde if you want to.

[toc] | [prev] | [next] | [standalone]


#40677

From"Michael Ross" <gmx@ross.cx>
Date2013-03-07 01:25 +0100
Message-ID<mailman.2967.1362615925.2939.python-list@python.org>
In reply to#40666
On Thu, 07 Mar 2013 00:18:44 +0100, Νίκος Γκρ33κ <nikos.gr33k@gmail.com>  
wrote:

> Τη Τετάρτη, 6 Μαρτίου 2013 2:06:33 π.μ. UTC+2, ο χρήστης Michael Ross  
> έγραψε:
>
>> check_output is available as of Python 2.7
>> I guess you are still on version 2.6 ?
>
>
> I can access each of these from my jailed shell user account without  
> issue, and especially i try /usr/bin/python3
>
> nikos@superhost.gr [~]# /usr/bin/python -V
> Python 2.6.6
>
> nikos@superhost.gr [~]# /opt/python3/bin/python3 -V
> Python 3.2.3
>
> nikos@superhost.gr [~]# /usr/bin/python3 -V
> Python 3.2.3
>
>
> Problem is that when i change my shebang constructor to  
> #!/sur/bin/python3 my '/cgi-bin/metrites.py' python cgi scripts produces  
> an internal server error while with #!/sur/bin/python the script works.
>
> Any ideas as to why? I can post ocde if you want to.


You need to post the Traceback.

Either run /usr/bin/python3 /cgi-bin/metrites.py on the shell
or better look in your webserver error log.

Guess:
In Python 3 "print" is a function.
So
	print "something"
will not work. You need to
	print("something")

[toc] | [prev] | [next] | [standalone]


#40706

FromΝίκος Γκρ33κ <nikos.gr33k@gmail.com>
Date2013-03-06 22:35 -0800
Message-ID<78e92c1d-521b-440c-9517-84406cdc6d6a@googlegroups.com>
In reply to#40677
Τη Πέμπτη, 7 Μαρτίου 2013 2:25:09 π.μ. UTC+2, ο χρήστης Michael Ross έγραψε:

> Either run /usr/bin/python3 /cgi-bin/metrites.py on the shell 
> or better look in your webserver error log.

> Guess:
> In Python 3 "print" is a function. 
> So
> 	print "something"
> will not work. You need to
> 
> 	print("something")

Yes Michael i have already prinr with parenthesis except form the triple quoting:	


	print ''' <center><h2><font color=lime> LOG </font> όλων των <font color=red> HTML </font> σελίδων</h2><br>
		  <table border=5 cellpadding=5 bgcolor=black>
		  <th><font color=orange size=5> Σελίδα </th>  <th><font color=orange size=5> Επισκέψεις </th>
	'''

have turned to:


print(''' <center><h2><font color=lime> LOG </font> όλων των <font color=red> HTML </font> σελίδων</h2><br>
		  <table border=5 cellpadding=5 bgcolor=black>
		  <th><font color=orange size=5> Σελίδα </th>  <th><font color=orange size=5> Επισκέψεις </th>
	''')


but now iam receiving this error concering except:

nikos@superhost.gr [~/www/cgi-bin]# /usr/bin/python3 metrites.py 
  File "metrites.py", line 88
    except MySQLdb.Error, e:
                        ^
SyntaxError: invalid syntax
nikos@superhost.gr [~/www/cgi-bin]# 

which used to work ok in v2.6.6

can you help?

[toc] | [prev] | [next] | [standalone]


#40720

FromRoland Koebler <r.koebler@yahoo.de>
Date2013-03-07 09:58 +0100
Message-ID<mailman.2989.1362646702.2939.python-list@python.org>
In reply to#40706
Hi,

> but now iam receiving this error concering except:
> 
> nikos@superhost.gr [~/www/cgi-bin]# /usr/bin/python3 metrites.py 
>   File "metrites.py", line 88
>     except MySQLdb.Error, e:
>                         ^
> SyntaxError: invalid syntax
> nikos@superhost.gr [~/www/cgi-bin]# 
> 
> which used to work ok in v2.6.6
> 
> can you help?
Python 3 introduced some Python 2-incompatible changes.
So, please read: http://docs.python.org/release/3.0.1/whatsnew/3.0.html

Roland

[toc] | [prev] | [next] | [standalone]


#40721

FromΝίκος Γκρ33κ <nikos.gr33k@gmail.com>
Date2013-03-07 01:05 -0800
Message-ID<8dbd532b-2007-46e5-9e05-e3b2597d78d9@googlegroups.com>
In reply to#40720
Τη Πέμπτη, 7 Μαρτίου 2013 10:58:13 π.μ. UTC+2, ο χρήστης Roland Koebler έγραψε:
> Hi,
> 
> 
> 
> > but now iam receiving this error concering except:
> 
> > 
> 
> > nikos@superhost.gr [~/www/cgi-bin]# /usr/bin/python3 metrites.py 
> 
> >   File "metrites.py", line 88
> 
> >     except MySQLdb.Error, e:
> 
> >                         ^
> 
> > SyntaxError: invalid syntax
> 
> > nikos@superhost.gr [~/www/cgi-bin]# 
> 
> > 
> 
> > which used to work ok in v2.6.6
> 
> > 
> 
> > can you help?
> 
> Python 3 introduced some Python 2-incompatible changes.
> 
> So, please read: http://docs.python.org/release/3.0.1/whatsnew/3.0.html
> 
> 
> 
> Roland

I did read about print but i'm interesetd to see and its not mentioned there how

	except MySQLdb.Error, e:
		print ( "Query Error: ", sys.exc_info()[1].excepinfo()[2] )

is supposed to be written as in Python v3.x

[toc] | [prev] | [next] | [standalone]


#40725

FromLele Gaifax <lele@metapensiero.it>
Date2013-03-07 10:22 +0100
Message-ID<mailman.2992.1362648141.2939.python-list@python.org>
In reply to#40721
Νίκος Γκρ33κ <nikos.gr33k@gmail.com> writes:

> I did read about print but i'm interesetd to see and its not mentioned there how
>
> 	except MySQLdb.Error, e:
> 		print ( "Query Error: ", sys.exc_info()[1].excepinfo()[2] )
>
> is supposed to be written as in Python v3.x

Read better:
http://docs.python.org/release/3.0.1/whatsnew/3.0.html#changed-syntax
4th (bullet) point.

ciao, lele.
-- 
nickname: Lele Gaifax | Quando vivrò di quello che ho pensato ieri
real: Emanuele Gaifas | comincerò ad aver paura di chi mi copia.
lele@metapensiero.it  |                 -- Fortunato Depero, 1929.

[toc] | [prev] | [next] | [standalone]


#40730

FromΝίκος Γκρ33κ <nikos.gr33k@gmail.com>
Date2013-03-07 01:28 -0800
Message-ID<74843fc3-7ecd-473a-8271-c9f9d3085475@googlegroups.com>
In reply to#40725
Τη Πέμπτη, 7 Μαρτίου 2013 11:22:09 π.μ. UTC+2, ο χρήστης Lele Gaifax έγραψε:
> Νίκος Γκρ33κ <nikos.gr33k@gmail.com> writes:
> 
> 
> 
> > I did read about print but i'm interesetd to see and its not mentioned there how
> 
> >
> 
> > 	except MySQLdb.Error, e:
> 
> > 		print ( "Query Error: ", sys.exc_info()[1].excepinfo()[2] )
> 
> >
> 
> > is supposed to be written as in Python v3.x
> 
> 
> 
> Read better:
> 
> http://docs.python.org/release/3.0.1/whatsnew/3.0.html#changed-syntax
> 
> 4th (bullet) point.
> 
> 
> 
> ciao, lele.
> 
> -- 
> 
> nickname: Lele Gaifax | Quando vivrò di quello che ho pensato ieri
> 
> real: Emanuele Gaifas | comincerò ad aver paura di chi mi copia.
> 
> lele@metapensiero.it  |                 -- Fortunato Depero, 1929.

please give me the exact link to read, i cant seem to find it although you send 4th bullet i do not see it....

[toc] | [prev] | [next] | [standalone]


#40736

FromLele Gaifax <lele@metapensiero.it>
Date2013-03-07 10:50 +0100
Message-ID<mailman.3001.1362649858.2939.python-list@python.org>
In reply to#40730
Νίκος Γκρ33κ <nikos.gr33k@gmail.com> writes:

> Τη Πέμπτη, 7 Μαρτίου 2013 11:22:09 π.μ. UTC+2, ο χρήστης Lele Gaifax έγραψε:
>> http://docs.python.org/release/3.0.1/whatsnew/3.0.html#changed-syntax
>> 
>> 4th (bullet) point.
>
> please give me the exact link to read, i cant seem to find it although
> you send 4th bullet i do not see it....

Oh come on Νίκος, the above *is* the *exact* link to read, I even
pointed at the right subparagraph: it contains both a link to the
reference manual for the "except" keyword, and a link to the PEP that
talks about the change.

ciao, lele.
-- 
nickname: Lele Gaifax | Quando vivrò di quello che ho pensato ieri
real: Emanuele Gaifas | comincerò ad aver paura di chi mi copia.
lele@metapensiero.it  |                 -- Fortunato Depero, 1929.

[toc] | [prev] | [next] | [standalone]


#40738

FromΝίκος Γκρ33κ <nikos.gr33k@gmail.com>
Date2013-03-07 01:55 -0800
Message-ID<346f2960-9911-4634-861c-ac8ea01f98b6@googlegroups.com>
In reply to#40736
Τη Πέμπτη, 7 Μαρτίου 2013 11:50:42 π.μ. UTC+2, ο χρήστης Lele Gaifax έγραψε:
> Νίκος Γκρ33κ <nikos.gr33k@gmail.com> writes:
> 
> 
> 
> > Τη Πέμπτη, 7 Μαρτίου 2013 11:22:09 π.μ. UTC+2, ο χρήστης Lele Gaifax έγραψε:
> 
> >> http://docs.python.org/release/3.0.1/whatsnew/3.0.html#changed-syntax
> 
> >> 
> 
> >> 4th (bullet) point.
> 
> >
> 
> > please give me the exact link to read, i cant seem to find it although
> 
> > you send 4th bullet i do not see it....
> 
> 
> 
> Oh come on Νίκος, the above *is* the *exact* link to read, I even
> 
> pointed at the right subparagraph: it contains both a link to the
> 
> reference manual for the "except" keyword, and a link to the PEP that
> 
> talks about the change.
> 
> 
> 
> ciao, lele.
> 
> -- 
> 
> nickname: Lele Gaifax | Quando vivrò di quello che ho pensato ieri
> 
> real: Emanuele Gaifas | comincerò ad aver paura di chi mi copia.
> 
> lele@metapensiero.it  |                 -- Fortunato Depero, 1929.

call me an idiot but is till dont see it:

i;am currently trying this:

except MySQLdb.OperationalError, e:

but give sme an internal server error too :(

[toc] | [prev] | [next] | [standalone]


#40740

FromΝίκος Γκρ33κ <nikos.gr33k@gmail.com>
Date2013-03-07 01:55 -0800
Message-ID<mailman.3003.1362650161.2939.python-list@python.org>
In reply to#40736
Τη Πέμπτη, 7 Μαρτίου 2013 11:50:42 π.μ. UTC+2, ο χρήστης Lele Gaifax έγραψε:
> Νίκος Γκρ33κ <nikos.gr33k@gmail.com> writes:
> 
> 
> 
> > Τη Πέμπτη, 7 Μαρτίου 2013 11:22:09 π.μ. UTC+2, ο χρήστης Lele Gaifax έγραψε:
> 
> >> http://docs.python.org/release/3.0.1/whatsnew/3.0.html#changed-syntax
> 
> >> 
> 
> >> 4th (bullet) point.
> 
> >
> 
> > please give me the exact link to read, i cant seem to find it although
> 
> > you send 4th bullet i do not see it....
> 
> 
> 
> Oh come on Νίκος, the above *is* the *exact* link to read, I even
> 
> pointed at the right subparagraph: it contains both a link to the
> 
> reference manual for the "except" keyword, and a link to the PEP that
> 
> talks about the change.
> 
> 
> 
> ciao, lele.
> 
> -- 
> 
> nickname: Lele Gaifax | Quando vivrò di quello che ho pensato ieri
> 
> real: Emanuele Gaifas | comincerò ad aver paura di chi mi copia.
> 
> lele@metapensiero.it  |                 -- Fortunato Depero, 1929.

call me an idiot but is till dont see it:

i;am currently trying this:

except MySQLdb.OperationalError, e:

but give sme an internal server error too :(

[toc] | [prev] | [next] | [standalone]


#40742

FromChris Angelico <rosuav@gmail.com>
Date2013-03-07 21:19 +1100
Message-ID<mailman.3004.1362651548.2939.python-list@python.org>
In reply to#40730
On Thu, Mar 7, 2013 at 8:50 PM, Lele Gaifax <lele@metapensiero.it> wrote:
> Νίκος Γκρ33κ <nikos.gr33k@gmail.com> writes:
>
>> Τη Πέμπτη, 7 Μαρτίου 2013 11:22:09 π.μ. UTC+2, ο χρήστης Lele Gaifax έγραψε:
>>> http://docs.python.org/release/3.0.1/whatsnew/3.0.html#changed-syntax
>>>
>>> 4th (bullet) point.
>>
>> please give me the exact link to read, i cant seem to find it although
>> you send 4th bullet i do not see it....
>
> Oh come on Νίκος, the above *is* the *exact* link to read, I even
> pointed at the right subparagraph: it contains both a link to the
> reference manual for the "except" keyword, and a link to the PEP that
> talks about the change.

I think it's time to take him up on his offer to call him an idiot :)

Nikos, try 'as'.

ChrisA

[toc] | [prev] | [next] | [standalone]


#40744

FromΝίκος Γκρ33κ <nikos.gr33k@gmail.com>
Date2013-03-07 02:34 -0800
Message-ID<a8c43cc2-87f4-4aea-bfd9-7fc36efdc23c@googlegroups.com>
In reply to#40742
Τη Πέμπτη, 7 Μαρτίου 2013 12:19:05 μ.μ. UTC+2, ο χρήστης Chris Angelico έγραψε:
> On Thu, Mar 7, 2013 at 8:50 PM, Lele Gaifax <lele@metapensiero.it> wrote:
> 
> > Νίκος Γκρ33κ <nikos.gr33k@gmail.com> writes:
> 
> >
> 
> >> Τη Πέμπτη, 7 Μαρτίου 2013 11:22:09 π.μ. UTC+2, ο χρήστης Lele Gaifax έγραψε:
> 
> >>> http://docs.python.org/release/3.0.1/whatsnew/3.0.html#changed-syntax
> 
> >>>
> 
> >>> 4th (bullet) point.
> 
> >>
> 
> >> please give me the exact link to read, i cant seem to find it although
> 
> >> you send 4th bullet i do not see it....
> 
> >
> 
> > Oh come on Νίκος, the above *is* the *exact* link to read, I even
> 
> > pointed at the right subparagraph: it contains both a link to the
> 
> > reference manual for the "except" keyword, and a link to the PEP that
> 
> > talks about the change.
> 
> 
> 
> I think it's time to take him up on his offer to call him an idiot :)
> 
> 
> 
> Nikos, try 'as'.
> 
> 
> 
> ChrisA

Thank you all the trick was to replace the comma with the 'as'

script is almost ready for Python v3.2.3 now!

ima just receivign this error:

--> -->
Traceback (most recent call last):
  File "/opt/python3/lib/python3.2/site-packages/MySQL_python-1.2.3-py3.2-linux-x86_64.egg/MySQLdb/cursors.py", line 171, in execute
    r = self._query(query)
  File "/opt/python3/lib/python3.2/site-packages/MySQL_python-1.2.3-py3.2-linux-x86_64.egg/MySQLdb/cursors.py", line 330, in _query
    rowcount = self._do_query(q)
  File "/opt/python3/lib/python3.2/site-packages/MySQL_python-1.2.3-py3.2-linux-x86_64.egg/MySQLdb/cursors.py", line 294, in _do_query
    db.query(q)
_mysql_exceptions.ProgrammingError: (1064, "You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '%s' at line 1")

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "metrites.py", line 212, in <module>
    cur.execute( '''SELECT hits FROM counters WHERE url = %s''', (htmlpage,) )
  File "/opt/python3/lib/python3.2/site-packages/MySQL_python-1.2.3-py3.2-linux-x86_64.egg/MySQLdb/cursors.py", line 184, in execute
    self.errorhandler(self, exc, value)
  File "/opt/python3/lib/python3.2/site-packages/MySQL_python-1.2.3-py3.2-linux-x86_64.egg/MySQLdb/connections.py", line 36, in defaulterrorhandler
    raise errorclass(errorvalue)
_mysql_exceptions.ProgrammingError: (1064, "You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '%s' at line 1")

Tou cna see it more clearly at my website http://superhost.gr

[toc] | [prev] | [next] | [standalone]


Page 2 of 3 — ← Prev page 1 [2] 3  Next page →

Back to top | Article view | comp.lang.python


csiph-web