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

2013-03-07 Thread Roland Koebler
Hi, but now iam receiving this error concering except: ni...@superhost.gr [~/www/cgi-bin]# /usr/bin/python3 metrites.py File metrites.py, line 88 except MySQLdb.Error, e: ^ SyntaxError: invalid syntax ni...@superhost.gr [~/www/cgi-bin]# which used to

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

2013-03-07 Thread Νίκος Γκρ33κ
Τη Πέμπτη, 7 Μαρτίου 2013 10:58:13 π.μ. UTC+2, ο χρήστης Roland Koebler έγραψε: Hi, but now iam receiving this error concering except: ni...@superhost.gr [~/www/cgi-bin]# /usr/bin/python3 metrites.py File metrites.py, line 88 except MySQLdb.Error, e:

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

2013-03-07 Thread Lele Gaifax
Νίκος Γκρ33κ nikos.gr...@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:

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

2013-03-07 Thread Νίκος Γκρ33κ
Τη Πέμπτη, 7 Μαρτίου 2013 11:22:09 π.μ. UTC+2, ο χρήστης Lele Gaifax έγραψε: Νίκος Γκρ33κ nikos.gr...@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: ,

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

2013-03-07 Thread Νίκος Γκρ33κ
Τη Πέμπτη, 7 Μαρτίου 2013 11:50:42 π.μ. UTC+2, ο χρήστης Lele Gaifax έγραψε: Νίκος Γκρ33κ nikos.gr...@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

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

2013-03-07 Thread Lele Gaifax
Νίκος Γκρ33κ nikos.gr...@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

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

2013-03-07 Thread Νίκος Γκρ33κ
This fails also: except MySQLdb.ProgrammingError, e: How on earth the exception is suppsoed to be written -- http://mail.python.org/mailman/listinfo/python-list

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

2013-03-07 Thread Chris Angelico
On Thu, Mar 7, 2013 at 8:50 PM, Lele Gaifax l...@metapensiero.it wrote: Νίκος Γκρ33κ nikos.gr...@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

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

2013-03-07 Thread Joel Goldstick
On Thu, Mar 7, 2013 at 5:09 AM, Νίκος Γκρ33κ nikos.gr...@gmail.com wrote: This fails also: except MySQLdb.ProgrammingError, e: How on earth the exception is suppsoed to be written Change from excepthttp://docs.python.org/release/3.0.1/reference/compound_stmts.html#except *exc*, *var*

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

2013-03-07 Thread Νίκος Γκρ33κ
Τη Πέμπτη, 7 Μαρτίου 2013 12:19:05 μ.μ. UTC+2, ο χρήστης Chris Angelico έγραψε: On Thu, Mar 7, 2013 at 8:50 PM, Lele Gaifax l...@metapensiero.it wrote: Νίκος Γκρ33κ nikos.gr...@gmail.com writes: Τη Πέμπτη, 7 Μαρτίου 2013 11:22:09 π.μ. UTC+2, ο χρήστης Lele Gaifax έγραψε:

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

2013-03-07 Thread Νίκος Γκρ33κ
host = socket.gethostbyaddr( os.environ['REMOTE_ADDR'] )[0] Why this line that worked in v2.6 give sme an error in v3.2.3 Traceback (most recent call last): File files.py, line 14, in lt;modulegt; host = socket.gethostbyaddr( os.environ['REMOTE_ADDR'] )[0] File

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

2013-03-07 Thread Νίκος Γκρ33κ
An these kind of errors iam receiving to please: Original exception was: Traceback (most recent call last): File pelatologio.py, line 230, in module ''') % (clients, hits, money) UnicodeEncodeError: 'ascii' codec can't encode characters in position 102-108: ordinal not in range(128) in

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

2013-03-07 Thread Chris Angelico
On Thu, Mar 7, 2013 at 11:06 PM, Νίκος Γκρ33κ nikos.gr...@gmail.com wrote: An these kind of errors iam receiving to please: Part of being a computer programmer is learning to solve problems. Dumping piles of problems onto a list like this isn't the best way to do this. Either pay someone to do

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

2013-03-06 Thread Roland Koebler
Hi, On Tue, Mar 05, 2013 at 09:39:19AM -0800, Νίκος Γκρ33κ wrote: But i did, I just tried this: # open html template if htmlpage.endswith('.html'): f = open( /home/nikos/public_html/ + htmlpage ) htmldata = f.read() counter =

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

2013-03-06 Thread Νίκος Γκρ33κ
Τη Τετάρτη, 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

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

2013-03-06 Thread Michael Ross
On Thu, 07 Mar 2013 00:18:44 +0100, Νίκος Γκρ33κ nikos.gr...@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

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

2013-03-06 Thread Νίκος Γκρ33κ
Τη Πέμπτη, 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

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

2013-03-06 Thread Νίκος Γκρ33κ
The whole try stement is as follows to have the compete idea: try: cur.execute( '''SELECT url, hits FROM counters ORDER BY hits DESC''' ) data = cur.fetchall() for row in data: (url, hits) = row

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

2013-03-05 Thread Νίκος Γκρ33κ
Any ideas on hopw to embed some html data at the end of each python script? -- http://mail.python.org/mailman/listinfo/python-list

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

2013-03-05 Thread Mark Lawrence
On 05/03/2013 17:11, Νίκος Γκρ33κ wrote: Any ideas on hopw to embed some html data at the end of each python script? Write some code. -- Cheers. Mark Lawrence -- http://mail.python.org/mailman/listinfo/python-list

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

2013-03-05 Thread Joel Goldstick
On Tue, Mar 5, 2013 at 12:19 PM, Mark Lawrence breamore...@yahoo.co.ukwrote: On 05/03/2013 17:11, Νίκος Γκρ33κ wrote: Any ideas on hopw to embed some html data at the end of each python script? http://redwing.hutman.net/~mreed/warriorshtm/ferouscranus.htm Write some code. -- Cheers.

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

2013-03-05 Thread Joel Goldstick
On Tue, Mar 5, 2013 at 12:39 PM, Νίκος Γκρ33κ nikos.gr...@gmail.com wrote: But i did, I just tried this: # open html template if htmlpage.endswith('.html'): f = open( /home/nikos/public_html/ + htmlpage ) htmldata = f.read()

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

2013-03-05 Thread Νίκος Γκρ33κ
What extra triple quote? There are 2 sets of triple quotes the counter's and the print's !! in case htmlpage variable is a .py file i must append a print '''html''' in order for .py code to absorve that code properly no? -- http://mail.python.org/mailman/listinfo/python-list

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

2013-03-05 Thread Mark Lawrence
On 05/03/2013 17:39, Νίκος Γκρ33κ wrote: But i did, I just tried this: # open html template if htmlpage.endswith('.html'): f = open( /home/nikos/public_html/ + htmlpage ) htmldata = f.read() counter = ''' centera

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

2013-03-05 Thread Dave Angel
On 03/05/2013 12:49 PM, Νίκος Γκρ33κ wrote: What extra triple quote? There are 2 sets of triple quotes the counter's and the print's !! There are 3 pairs of triple-quotes. But one pair is nested inside the other, so the interpreter will not handle it the way you apparently want. If you

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

2013-03-05 Thread Νίκος Γκρ33κ
Let's focus on just the following snipper please: f = open( some_python_file ) htmldata = f.read() counter = ''' print( centera href=mailto:supp...@superhost.gr; img src=/data/images/mail.png /a centertable border=2

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

2013-03-05 Thread Joel Goldstick
On Tue, Mar 5, 2013 at 1:53 PM, Νίκος Γκρ33κ nikos.gr...@gmail.com wrote: Let's focus on just the following snipper please: f = open( some_python_file ) htmldata = f.read() counter = ''' print( centera href=mailto:supp...@superhost.gr; img

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

2013-03-05 Thread Dave Angel
On 03/05/2013 01:53 PM, Νίκος Γκρ33κ wrote: Let's focus on just the following snipper please: Once again, I repeat. Make a fragment that contains enough information to actually run. Explain in what environment it's running, and what you hoped would happen. For example, why on earth would

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

2013-03-05 Thread Νίκος Γκρ33κ
#open html template if htmlpage.endswith('.html'): f = open( /home/nikos/public_html/ + htmlpage ) htmldata = f.read() counter = ''' centera href=mailto:supp...@superhost.gr; img src=/data/images/mail.png /a

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

2013-03-05 Thread Dave Angel
On 03/05/2013 03:04 PM, Νίκος Γκρ33κ wrote: #open html template if htmlpage.endswith('.html'): f = open( /home/nikos/public_html/ + htmlpage ) htmldata = f.read() counter = ''' centera href=mailto:supp...@superhost.gr; img

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

2013-03-05 Thread Michael Ross
On Tue, 05 Mar 2013 21:04:59 +0100, Νίκος Γκρ33κ nikos.gr...@gmail.com wrote: #open html template if htmlpage.endswith('.html'): f = open( /home/nikos/public_html/ + htmlpage ) htmldata = f.read() counter = ''' centera

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

2013-03-05 Thread Νίκος Γκρ33κ
Τη Τρίτη, 5 Μαρτίου 2013 11:02:18 μ.μ. UTC+2, ο χρήστης Dave Angel έγραψε: In other words, you're just trying to waste our time. Thanks for telling us. Honestly, its not in my intentions to waste your time. I appreciate all the great help you have provided me in all of my questions, i

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

2013-03-05 Thread Michael Ross
On Tue, 05 Mar 2013 23:47:18 +0100, Νίκος Γκρ33κ nikos.gr...@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

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

2013-03-05 Thread Νίκος Γκρ33κ
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. --

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

2013-03-05 Thread Michael Ross
On Wed, 06 Mar 2013 00:39:31 +0100, Νίκος Γκρ33κ nikos.gr...@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

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

2013-03-05 Thread Νίκος Γκρ33κ
Τη Τετάρτη, 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(

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

2013-03-05 Thread Νίκος Γκρ33κ
Τη Τετάρτη, 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.