Re: [error] [client 178.59.111.223] (2)No such file or directory: exec of
On Wed, 28 Aug 2013 21:20:01 -0700, Ferrous Cranus wrote: [Thu Aug 29 04:18:04 2013] [error] [client 108.162.229.127] File /home/nikos/public_html/cgi-bin/metrites.py, line 206, in module [Thu Aug 29 04:18:04 2013] [error] [client 108.162.229.127] cur.execute('''SELECT hits FROM counters WHERE url = %s''', page ) [...] TypeError: unsupported operand type(s) for %: 'bytes' and 'str' Oh look, it's exactly the same error you started with. Congratulations, you've made exactly no progress. As I asked you yesterday: And what result does form.getvalue return? What is its type? Is it a list, a tuple, a dict, a bytes object, a float, a str object, something else? Have you worked that out yet? If you can't work it out, you can guess, and then test your guess: page = form.getvalue('page') if isinstance(page, list): raise TypeError('guessed it was a list, it is a list') If your guess is wrong, try another guess. Keep going until you work out what type page is. If you can't write to a data file, you can write to the error log: page = form.getvalue('page') raise TypeError('type of page is %r' % type(page)) Keep going until you find out what type of data the variable 'page' is holding. Now read the error message again: unsupported operand type(s) for %: 'bytes' and 'str' Do you understand what that error means? Here is a hint: start a Python interactive session, and try things for yourself: steve@runes:~$ python3.3 Python 3.3.0rc3 (default, Sep 27 2012, 18:31:58) [GCC 4.4.5] on linux Type help, copyright, credits or license for more information. py py 'string%s' % 'string' 'stringstring' py py b'bytes%s' % b'bytes' Traceback (most recent call last): File stdin, line 1, in module TypeError: unsupported operand type(s) for %: 'bytes' and 'bytes' Do you see a pattern yet? What do you think will happen if you run this? b'bytes%s' % 'string' Try it and see for yourself. Now look at the error message you are getting. Is it the same error message? Do you think that perhaps it has the same cause? How do you think you might solve this problem? Hint: if you have a data item that is type A, and you need it to be type B, you need to convert from A to B. -- Steven -- http://mail.python.org/mailman/listinfo/python-list
Re: [error] [client 178.59.111.223] (2)No such file or directory: exec of
Τη Τρίτη, 27 Αυγούστου 2013 8:07:52 μ.μ. UTC+3, ο χρήστης Steven D'Aprano έγραψε: On Tue, 27 Aug 2013 18:04:23 +0300, Ferrous Cranus wrote: So, in this line: cur.execute('''SELECT ID FROM counters WHERE url = %s''', page ) the variable 'page' needs conversion to what? You tell us. You want to be a programmer, *you* need to do the programming, and not just keep asking others to solve every single bug. You have been given all the clues to solve this problem. Start by checking what the type of 'page' is, then decide what it ought to be. Hint: you can use print(type(page), file=open('path/to/some/file', 'w')) to see the type of the variable 'page' without displaying it on your website. all that is stores is the location of a file path = '/home/nikos/public_html/' page = form.getvalue('page') And what result does form.getvalue return? What is its type? Is it a list, a tuple, a dict, a bytes object, a float, a str object, something else? DON'T GUESS, and don't assume, find out for sure, by inspecting the result. if not page and os.path.exists( file ): # it is an html template page = file.replace( path, '' ) So chnage it to what? What do you think you need to change it to? Pick one: 1) bytes 2) an integer 3) a string 4) a list of floats 5) something else -- Steven Hello Steven, i tried to do what you said and iam receing this: [Wed Aug 28 08:43:31 2013] [error] [client 108.162.231.120] Original exception was: [Wed Aug 28 08:43:31 2013] [error] [client 108.162.231.120] Traceback (most recent call last): [Wed Aug 28 08:43:31 2013] [error] [client 108.162.231.120] File /home/nikos/public_html/cgi-bin/metrites.py, line 39, in module [Wed Aug 28 08:43:31 2013] [error] [client 108.162.231.120] print( type(page), file=open('../err.out', 'w') ) [Wed Aug 28 08:43:31 2013] [error] [client 108.162.231.120] PermissionError: [Errno 13] \\u0386\\u03c1\\u03bd\\u03b7\\u03c3\\u03b7 \\u03c0\\u03c1\\u03cc\\u03c3\\u03b2\\u03b1\\u03c3\\u03b7\\u03c2: '../err.out' [Wed Aug 28 08:43:31 2013] [error] [client 108.162.231.120] Premature end of script headers: metrites.py Also many times when i try to view the error_log by tail -F /usr/local/apache/logs/error_log i get realtime scrolling of other joomla webistes pho errors and i have hard time trackign my own webistes erros. is ther a work around for that? -- http://mail.python.org/mailman/listinfo/python-list
Re: [error] [client 178.59.111.223] (2)No such file or directory: exec of
In my attemtpt to be shwon only mesages pertaining to superhost.gr i try: alias err='tail -F /usr/local/apache/logs/error_log | grep nikos ' but now it only displays to me the lines that have '/home/nikos' within them and not all the relevant error lines. -- http://mail.python.org/mailman/listinfo/python-list
Re: [error] [client 178.59.111.223] (2)No such file or directory: exec of
Τη Τρίτη, 27 Αυγούστου 2013 6:22:32 μ.μ. UTC+3, ο χρήστης ishish έγραψε: Am 27.08.2013 16:04, schrieb Ferrous Cranus: Στις 27/8/2013 4:59 μμ, ο/η ishish έγραψε: [Tue Aug 27 13:02:57 2013] [error] [client 110.202.175.189] Error in sys.excepthook: [Tue Aug 27 13:02:57 2013] [error] [client 110.202.175.189] ValueError: underlying buffer has been detached [Tue Aug 27 13:02:57 2013] [error] [client 110.202.175.189] [Tue Aug 27 13:02:57 2013] [error] [client 110.202.175.189] Original exception was: [Tue Aug 27 13:02:57 2013] [error] [client 110.202.175.189] Traceback (most recent call last): [Tue Aug 27 13:02:57 2013] [error] [client 110.202.175.189] File /home/nikos/public_html/cgi-bin/metrites.py, line 169, in module [Tue Aug 27 13:02:57 2013] [error] [client 110.202.175.189] cur.execute('''SELECT ID FROM counters WHERE url = %s''', page ) [Tue Aug 27 13:02:57 2013] [error] [client 110.202.175.189] File /usr/local/bin/python/lib/python3.3/site-packages/pymysql/cursors.py, line 108, in execute [Tue Aug 27 13:02:57 2013] [error] [client 110.202.175.189] query = query % escaped_args [Tue Aug 27 13:02:57 2013] [error] [client 110.202.175.189] TypeError: unsupported operand type(s) for %: 'bytes' and 'str' I quote from a Python 3 Guide [http://python.about.com/od/python30/ss/30_strings_3.htm]: The two data types, str and bytes, are mutually exclusive. One cannot legally combine them into one call. With the distinction between text and data, therefore, comes the need to convert between them. So, in this line: cur.execute('''SELECT ID FROM counters WHERE url = %s''', page ) the variable 'page' needs conversion to what? all that is stores is the location of a file path = '/home/nikos/public_html/' page = form.getvalue('page') if not page and os.path.exists( file ): # it is an html template page = file.replace( path, '' ) So chnage it to what? -- What is now proved was at first only imagined! The error occurs in file /usr/local/bin/python/lib/python3.3/site-packages/pymysql/cursors.py, line 108, in execute query = query % escaped_args You can check the actual values and data types using: print repr(query) print type(query) print repr(escaped_args) print type(escaped_args) Always useful is a proper exception handling using try:/except: hOW YOU MEAN PLEASE I TRY TO IMPLMENT WHAT YOU PROPOSE BUT I CANT. try: #find the needed counter for the page URL if os.path.exists( path + page ) or os.path.exists( cgi_path + page ): cur.execute('''SELECT ID FROM counters WHERE url = %s''', page ) data = cur.fetchone() #URL is unique, so should only be one print repr('''SELECT ID FROM counters WHERE url = %s''') print type('''SELECT ID FROM counters WHERE url = %s''') print repr(escaped_args) print type(escaped_args) I MEAN IF FAILS BEFORE IT TRIES TO GO INTO MY PRINT STAEMNT. HOW AM I GONNA CPATURE THE QUERY? -- http://mail.python.org/mailman/listinfo/python-list
Re: [error] [client 178.59.111.223] (2)No such file or directory: exec of
Am 28.08.2013 10:48, schrieb Ferrous Cranus: I quote from a Python 3 Guide [http://python.about.com/od/python30/ss/30_strings_3.htm]: The two data types, str and bytes, are mutually exclusive. One cannot legally combine them into one call. With the distinction between text and data, therefore, comes the need to convert between them. So, in this line: cur.execute('''SELECT ID FROM counters WHERE url = %s''', page ) the variable 'page' needs conversion to what? all that is stores is the location of a file path = '/home/nikos/public_html/' page = form.getvalue('page') if not page and os.path.exists( file ): # it is an html template page = file.replace( path, '' ) So chnage it to what? -- What is now proved was at first only imagined! The error occurs in file /usr/local/bin/python/lib/python3.3/site-packages/pymysql/cursors.py, line 108, in execute query = query % escaped_args You can check the actual values and data types using: print repr(query) print type(query) print repr(escaped_args) print type(escaped_args) Always useful is a proper exception handling using try:/except: hOW YOU MEAN PLEASE I TRY TO IMPLMENT WHAT YOU PROPOSE BUT I CANT. try: #find the needed counter for the page URL if os.path.exists( path + page ) or os.path.exists( cgi_path + page ): cur.execute('''SELECT ID FROM counters WHERE url = %s''', page ) data = cur.fetchone() #URL is unique, so should only be one print repr('''SELECT ID FROM counters WHERE url = %s''') print type('''SELECT ID FROM counters WHERE url = %s''') print repr(escaped_args) print type(escaped_args) I MEAN IF FAILS BEFORE IT TRIES TO GO INTO MY PRINT STAEMNT. HOW AM I GONNA CPATURE THE QUERY? http://i.stack.imgur.com/jiFfM.jpg http://wiki.python.org/moin/HandlingExceptions -- http://mail.python.org/mailman/listinfo/python-list
Re: [error] [client 178.59.111.223] (2)No such file or directory: exec of
Τη Τετάρτη, 28 Αυγούστου 2013 1:11:05 μ.μ. UTC+3, ο χρήστης ishish έγραψε: http://wiki.python.org/moin/HandlingExceptions is this how you mean? try: #find the needed counter for the page URL if os.path.exists( path + page ) or os.path.exists( cgi_path + page ): cur.execute('''SELECT ID FROM counters WHERE url = %s''', page ) data = cur.fetchone() #URL is unique, so should only be one except: print repr(query) print type(query) print repr(escaped_args) print type(escaped_args) but i cannot see the error_log because of constant scrolling of error output. -- http://mail.python.org/mailman/listinfo/python-list
Re: [error] [client 178.59.111.223] (2)No such file or directory: exec of
Τη Τετάρτη, 28 Αυγούστου 2013 1:43:08 μ.μ. UTC+3, ο χρήστης Ferrous Cranus έγραψε: Τη Τετάρτη, 28 Αυγούστου 2013 1:11:05 μ.μ. UTC+3, ο χρήστης ishish έγραψε: http://wiki.python.org/moin/HandlingExceptions is this how you mean? try: #find the needed counter for the page URL if os.path.exists( path + page ) or os.path.exists( cgi_path + page ): cur.execute('''SELECT ID FROM counters WHERE url = %s''', page ) data = cur.fetchone() #URL is unique, so should only be one except: print repr(query) print type(query) print repr(escaped_args) print type(escaped_args) but i cannot see the error_log because of constant scrolling of error output. i try: tail -F /usr/local/apache/logs/error_log | grep nikos ' and see the follwing. if i dont grep at all i cannot stop the eroor output: i...@superhost.gr [~]# [Wed Aug 28 10:44:22 2013] [error] [client 108.162.231.120] File /home/nikos/public_html/cgi-bin/metrites.py, line 173, in module [Wed Aug 28 10:44:22 2013] [error] [client 108.162.231.120] File /home/nikos/public_html/cgi-bin/metrites.py, line 176, in module [Wed Aug 28 10:44:22 2013] [error] [client 108.162.231.120] File does not exist: /home/nikos/public_html/500.shtml -- http://mail.python.org/mailman/listinfo/python-list
Re: [error] [client 178.59.111.223] (2)No such file or directory: exec of
Okey, continue trying and trying i came up with this: try: if os.path.exists( path + page ) or os.path.exists( cgi_path + page ): cur.execute('''SELECT ID FROM counters WHERE url = %s''', page ) data = cur.fetchone() except: with open(err.out, a) as f: f.write( repr(query), type(query) ) f.write( repr(escaped_args), type(escaped_args) ) But i cannot test it without looking at the error log which is scrolling like hell and doesn't even quit with a ctrl+c How will i manage to troubleshoot? Please confirm the above is correct and is what you were propsoing i shoudl test. -- http://mail.python.org/mailman/listinfo/python-list
Re: [error] [client 178.59.111.223] (2)No such file or directory: exec of
On 28/8/2013 07:14, Ferrous Cranus wrote: But i cannot test it without looking at the error log which is scrolling like hell and doesn't even quit with a ctrl+c I take it this 'error log is shared with other users, and you can't constrain them to cease and desist for a while? How will i manage to troubleshoot? Please confirm the above is correct and is what you were propsoing i shoudl test. You really have no directory in which you have write permissions? If so, perhaps you'd better solve that first. -- DaveA -- http://mail.python.org/mailman/listinfo/python-list
Re: [error] [client 178.59.111.223] (2)No such file or directory: exec of
Τη Τετάρτη, 28 Αυγούστου 2013 2:32:44 μ.μ. UTC+3, ο χρήστης Dave Angel έγραψε: On 28/8/2013 07:14, Ferrous Cranus wrote: But i cannot test it without looking at the error log which is scrolling like hell and doesn't even quit with a ctrl+c I take it this 'error log is shared with other users, and you can't constrain them to cease and desist for a while? How will i manage to troubleshoot? Please confirm the above is correct and is what you were propsoing i shoudl test. You really have no directory in which you have write permissions? If so, perhaps you'd better solve that first. hello Dave, no this is the general error log apache produces for all the server. Is there a way to grep error logging info, pertainign only to my specific nikos account or my superhost.gr domain? -- http://mail.python.org/mailman/listinfo/python-list
Re: [error] [client 178.59.111.223] (2)No such file or directory: exec of
Τη Τετάρτη, 28 Αυγούστου 2013 2:32:44 μ.μ. UTC+3, ο χρήστης Dave Angel έγραψε: On 28/8/2013 07:14, Ferrous Cranus wrote: But i cannot test it without looking at the error log which is scrolling like hell and doesn't even quit with a ctrl+c I take it this 'error log is shared with other users, and you can't constrain them to cease and desist for a while? How will i manage to troubleshoot? Please confirm the above is correct and is what you were propsoing i shoudl test. You really have no directory in which you have write permissions? If so, perhaps you'd better solve that first. -- DaveA [Wed Aug 28 11:34:36 2013] [error] [client 108.162.231.120] Error in sys.excepthook: [Wed Aug 28 11:34:36 2013] [error] [client 108.162.231.120] ValueError: underlying buffer has been detached [Wed Aug 28 11:34:36 2013] [error] [client 108.162.231.120] [Wed Aug 28 11:34:36 2013] [error] [client 108.162.231.120] Original exception was: [Wed Aug 28 11:34:36 2013] [error] [client 108.162.231.120] Traceback (most recent call last): [Wed Aug 28 11:34:36 2013] [error] [client 108.162.231.120] File /home/nikos/public_html/cgi-bin/metrites. py, line 173, in module [Wed Aug 28 11:34:36 2013] [error] [client 108.162.231.120] cur.execute('''SELECT ID FROM counters WHERE url = %s''', page ) [Wed Aug 28 11:34:36 2013] [error] [client 108.162.231.120] File /usr/local/bin/python/lib/python3.3/site- packages/pymysql/cursors.py, line 108, in execute [Wed Aug 28 11:34:36 2013] [error] [client 108.162.231.120] query = query % escaped_args [Wed Aug 28 11:34:36 2013] [error] [client 108.162.231.120] TypeError: unsupported operand type(s) for %: 'by tes' and 'str' [Wed Aug 28 11:34:36 2013] [error] [client 108.162.231.120] [Wed Aug 28 11:34:36 2013] [error] [client 108.162.231.120] During handling of the above exception, another e xception occurred: [Wed Aug 28 11:34:36 2013] [error] [client 108.162.231.120] [Wed Aug 28 11:34:36 2013] [error] [client 108.162.231.120] Traceback (most recent call last): [Wed Aug 28 11:34:36 2013] [error] [client 108.162.231.120] File /home/nikos/public_html/cgi-bin/metrites. py, line 176, in module [Wed Aug 28 11:34:36 2013] [error] [client 108.162.231.120] with open(err.out, a) as f: [Wed Aug 28 11:34:36 2013] [error] [client 108.162.231.120] PermissionError: [Errno 13] \\u0386\\u03c1\\u03bd \\u03b7\\u03c3\\u03b7 \\u03c0\\u03c1\\u03cc\\u03c3\\u03b2\\u03b1\\u03c3\\u03b7\\u03c2: 'err.out' [Wed Aug 28 11:34:36 2013] [error] [client 108.162.231.120] File does not exist: /home/nikos/public_html/500. shtml -- http://mail.python.org/mailman/listinfo/python-list
Re: [error] [client 178.59.111.223] (2)No such file or directory: exec of
Am 28.08.2013 12:14, schrieb Ferrous Cranus: Okey, continue trying and trying i came up with this: try: if os.path.exists( path + page ) or os.path.exists( cgi_path + page ): cur.execute('''SELECT ID FROM counters WHERE url = %s''', page ) data = cur.fetchone() except: with open(err.out, a) as f: f.write( repr(query), type(query) ) f.write( repr(escaped_args), type(escaped_args) ) But i cannot test it without looking at the error log which is scrolling like hell and doesn't even quit with a ctrl+c How will i manage to troubleshoot? Please confirm the above is correct and is what you were propsoing i shoudl test. A simple way I always use if it comes to exception handling: import sys import traceback # Exception Identification def formatExceptionInfo(maxTBlevel=5): cla, exc, trbk = sys.exc_info() excName = cla.__name__ try: excArgs = exc.__dict__[args] except KeyError: excArgs = no args excTb = traceback.format_tb(trbk, maxTBlevel) return (excName, excArgs, excTb) try: # Your code except: print formatExceptionInfo() -- http://mail.python.org/mailman/listinfo/python-list
Re: [error] [client 178.59.111.223] (2)No such file or directory: exec of
Τη Τετάρτη, 28 Αυγούστου 2013 2:32:44 μ.μ. UTC+3, ο χρήστης Dave Angel έγραψε: On 28/8/2013 07:14, Ferrous Cranus wrote: But i cannot test it without looking at the error log which is scrolling like hell and doesn't even quit with a ctrl+c I take it this 'error log is shared with other users, and you can't constrain them to cease and desist for a while? How will i manage to troubleshoot? Please confirm the above is correct and is what you were propsoing i shoudl test. You really have no directory in which you have write permissions? If so, perhaps you'd better solve that first. of cours ei ahve write permissions. Here: ni...@superhost.gr [~]# ls -ld www/ drwxr-x--- 4 nikos nobody 4096 Jul 13 10:33 www// ni...@superhost.gr [~]# ls -ld www/cgi-bin/ drwxr-xr-x 2 nikos nikos 4096 Aug 28 10:41 www/cgi-bin// whick make it a mysterya s to why with open(../err.out, a) as f: fails to write the file. -- http://mail.python.org/mailman/listinfo/python-list
Re: [error] [client 178.59.111.223] (2)No such file or directory: exec of
Τη Τετάρτη, 28 Αυγούστου 2013 2:51:03 μ.μ. UTC+3, ο χρήστης ishish έγραψε: Am 28.08.2013 12:14, schrieb Ferrous Cranus: Okey, continue trying and trying i came up with this: try: if os.path.exists( path + page ) or os.path.exists( cgi_path + page ): cur.execute('''SELECT ID FROM counters WHERE url = %s''', page ) data = cur.fetchone() except: with open(err.out, a) as f: f.write( repr(query), type(query) ) f.write( repr(escaped_args), type(escaped_args) ) But i cannot test it without looking at the error log which is scrolling like hell and doesn't even quit with a ctrl+c How will i manage to troubleshoot? Please confirm the above is correct and is what you were propsoing i shoudl test. A simple way I always use if it comes to exception handling: import sys import traceback # Exception Identification def formatExceptionInfo(maxTBlevel=5): cla, exc, trbk = sys.exc_info() excName = cla.__name__ try: excArgs = exc.__dict__[args] except KeyError: excArgs = no args excTb = traceback.format_tb(trbk, maxTBlevel) return (excName, excArgs, excTb) try: # Your code except: print formatExceptionInfo() ni...@superhost.gr [~/www]# [Wed Aug 28 12:02:53 2013] [error] [client 108.162.231.120] malformed header from script. Bad header=class 'str' 'index.html': metrites.py [Wed Aug 28 12:02:53 2013] [error] [client 108.162.231.120] Error in sys.excepthook: [Wed Aug 28 12:02:53 2013] [error] [client 108.162.231.120] ValueError: underlying buffer has been detached [Wed Aug 28 12:02:53 2013] [error] [client 108.162.231.120] [Wed Aug 28 12:02:53 2013] [error] [client 108.162.231.120] Original exception was: [Wed Aug 28 12:02:53 2013] [error] [client 108.162.231.120] Traceback (most recent call last): [Wed Aug 28 12:02:53 2013] [error] [client 108.162.231.120] File /home/nikos/public_html/cgi-bin/metrites.py, line 191, in module [Wed Aug 28 12:02:53 2013] [error] [client 108.162.231.120] if not data: [Wed Aug 28 12:02:53 2013] [error] [client 108.162.231.120] NameError: name 'data' is not defined [Wed Aug 28 12:02:53 2013] [error] [client 108.162.231.120] File does not exist: /home/nikos/public_html/500.shtml -- http://mail.python.org/mailman/listinfo/python-list
Re: [error] [client 178.59.111.223] (2)No such file or directory: exec of
On Wed, 28 Aug 2013 01:46:01 -0700, Ferrous Cranus wrote: Τη Τρίτη, 27 Αυγούστου 2013 8:07:52 μ.μ. UTC+3, ο χρήστης Steven D'Aprano έγραψε: Hint: you can use print(type(page), file=open('path/to/some/file', 'w')) to see the type of the variable 'page' without displaying it on your website. i tried to do what you said and iam receing this: [Wed Aug 28 08:43:31 2013] [error] [client 108.162.231.120] Original exception was: [Wed Aug 28 08:43:31 2013] [error] [client 108.162.231.120] Traceback (most recent call last): [Wed Aug 28 08:43:31 2013] [error] [client 108.162.231.120] File /home/nikos/public_html/cgi-bin/metrites.py, line 39, in module [Wed Aug 28 08:43:31 2013] [error] [client 108.162.231.120] print( type(page), file=open('../err.out', 'w') ) [Wed Aug 28 08:43:31 2013] [error] [client 108.162.231.120] PermissionError: [Errno 13] \\u0386\\u03c1\\u03bd\\u03b7\\u03c3\\u03b7 \\u03c0\\u03c1\\u03cc\\u03c3\\u03b2\\u03b1\\u03c3\\u03b7\\u03c2: '../err.out' [Wed Aug 28 08:43:31 2013] [error] [client 108.162.231.120] Premature end of script headers: metrites.py Then pick a different location, one where you have permission to write files! Honestly Nikos, I'm not trying to be rude, but if you cannot think of this on your own after all this time we've been helping you, perhaps programming is not the right vocation for you. Perhaps you need to consider a change of career. If you do decide to stay as a web developer, you need to start thinking: * What is this error message telling me? (Permission denied) * How can I fix that? (I need permission to read the file. Maybe try a different file?) Also many times when i try to view the error_log by tail -F /usr/local/apache/logs/error_log i get realtime scrolling of other joomla webistes pho errors and i have hard time trackign my own webistes erros. is ther a work around for that? That's an apache logging issue, not Python, and I don't know enough about apache to do more than guess that there probably is a solution but I have no idea what it is. -- Steven -- http://mail.python.org/mailman/listinfo/python-list
Re: [error] [client 178.59.111.223] (2)No such file or directory: exec of
Well there you have it: File /home/nikos/public_html/cgi-bin/metrites.py, line 191, in module if not data: NameError: name 'data' is not defined -- http://mail.python.org/mailman/listinfo/python-list
Re: [error] [client 178.59.111.223] (2)No such file or directory: exec of
Τη Τετάρτη, 28 Αυγούστου 2013 3:11:07 μ.μ. UTC+3, ο χρήστης Steven D'Aprano έγραψε: On Wed, 28 Aug 2013 01:46:01 -0700, Ferrous Cranus wrote: Τη Τρίτη, 27 Αυγούστου 2013 8:07:52 μ.μ. UTC+3, ο χρήστης Steven D'Aprano έγραψε: Hint: you can use print(type(page), file=open('path/to/some/file', 'w')) to see the type of the variable 'page' without displaying it on your website. i tried to do what you said and iam receing this: [Wed Aug 28 08:43:31 2013] [error] [client 108.162.231.120] Original exception was: [Wed Aug 28 08:43:31 2013] [error] [client 108.162.231.120] Traceback (most recent call last): [Wed Aug 28 08:43:31 2013] [error] [client 108.162.231.120] File /home/nikos/public_html/cgi-bin/metrites.py, line 39, in module [Wed Aug 28 08:43:31 2013] [error] [client 108.162.231.120] print( type(page), file=open('../err.out', 'w') ) [Wed Aug 28 08:43:31 2013] [error] [client 108.162.231.120] PermissionError: [Errno 13] \\u0386\\u03c1\\u03bd\\u03b7\\u03c3\\u03b7 \\u03c0\\u03c1\\u03cc\\u03c3\\u03b2\\u03b1\\u03c3\\u03b7\\u03c2: '../err.out' [Wed Aug 28 08:43:31 2013] [error] [client 108.162.231.120] Premature end of script headers: metrites.py Then pick a different location, one where you have permission to write files! Honestly Nikos, I'm not trying to be rude, but if you cannot think of this on your own after all this time we've been helping you, perhaps programming is not the right vocation for you. Perhaps you need to consider a change of career. If you do decide to stay as a web developer, you need to start thinking: * What is this error message telling me? (Permission denied) * How can I fix that? (I need permission to read the file. Maybe try a different file?) Also many times when i try to view the error_log by tail -F /usr/local/apache/logs/error_log i get realtime scrolling of other joomla webistes pho errors and i have hard time trackign my own webistes erros. is ther a work around for that? That's an apache logging issue, not Python, and I don't know enough about apache to do more than guess that there probably is a solution but I have no idea what it is. -- Steven As i have pointed out i as the owner of the accoutn have read and write perimssion bot at www/ and www/cgi-bin i also chnage the filename and still cant write to the file. if you as experts cannot help resolve this, how me as a newbiw can? -- http://mail.python.org/mailman/listinfo/python-list
Re: [error] [client 178.59.111.223] (2)No such file or directory: exec of
On Wed, 28 Aug 2013 03:43:08 -0700, Ferrous Cranus wrote: but i cannot see the error_log because of constant scrolling of error output. Then don't use tail -F, use less. Or try tail -s 60 -F which will update only every 60 seconds. -- Steven -- http://mail.python.org/mailman/listinfo/python-list
Re: [error] [client 178.59.111.223] (2)No such file or directory: exec of
Τη Τετάρτη, 28 Αυγούστου 2013 3:21:25 μ.μ. UTC+3, ο χρήστης Steven D'Aprano έγραψε: On Wed, 28 Aug 2013 03:43:08 -0700, Ferrous Cranus wrote: but i cannot see the error_log because of constant scrolling of error output. Then don't use tail -F, use less. Or try tail -s 60 -F which will update only every 60 seconds. -- Steven Very nice idea, than k you steven. Less work withiut scrilling like hell liek tail -F did. this is what i have now: # Exception Identification def formatExceptionInfo(maxTBlevel=5): cla, exc, trbk = sys.exc_info() excName = cla.__name__ try: excArgs = exc.__dict__[args] except KeyError: excArgs = no args excTb = traceback.format_tb(trbk, maxTBlevel) return (excName, excArgs, excTb) try: #find the needed counter for the page URL if os.path.exists( path + page ) or os.path.exists( cgi_path + page ): cur.execute('''SELECT ID FROM counters WHERE url = %s''', page ) data = cur.fetchone() #URL is unique, so should only be one except: print( formatExceptionInfo() ) i see no error on what it used ot be isnteait comain at the follwing line which is: if not data: #first time for page; primary key is automatic, hit is defaulted cur.execute('''INSERT INTO counters (url) VALUES (%s)''', page ) cID = cur.lastrowid#get the primary key value of the new record else: #found the page, save primary key and use it to issue hit UPDATE cID = data[0] cur.execute('''UPDATE counters SET hits = hits + 1 WHERE ID = %s''', cID ) i jst dont follow. What ishsi proposed supposed to give us the error in the query bit now it tells difefrent things. shoudl i remove the function since it want any helopfull? -- http://mail.python.org/mailman/listinfo/python-list
Re: [error] [client 178.59.111.223] (2)No such file or directory: exec of
On Wed, 28 Aug 2013 05:17:34 -0700, Ferrous Cranus wrote: As i have pointed out i as the owner of the accoutn have read and write perimssion bot at www/ and www/cgi-bin i also chnage the filename and still cant write to the file. If you type filenames as carelessly as you type requests for help, who knows what file name you are actually trying to open? Or to put it another way... If yuo tpye filnaems as carlesl yas y outype reqets for help, woh knwos wha tfile nmae oyu ar eactaly tying to oep n? Nikos, my Greek is completely non-existent, and I admire you for learning a second language. I know your English is good, because I have seen you write fluent, excellent English. But if you can't be bothered to type carefully and clearly when asking questions, then how can you expect others to be bothered to read and respond to your questions? if you as experts cannot help resolve this, how me as a newbiw can? Just because your account has write permission to a location doesn't mean that the script being run by the webserver has write permission. You need to write to a location where the script has permission to write. First you need to find out what account the script is being run under -- it may be apache, or possible nobody, but I don't know. It shouldn't be root, and almost certainly isn't nikos. I'm not an expert, but a few seconds googling came up with a lot of useful looking hits. Google on what user does apache run as and do your research. This is off-topic though. This is not a beginner's guide to apache forum, if you can't solve this problem yourself you'll have to take it elsewhere. -- Steven -- http://mail.python.org/mailman/listinfo/python-list
Re: [error] [client 178.59.111.223] (2)No such file or directory: exec of
Τη Τετάρτη, 28 Αυγούστου 2013 3:38:11 μ.μ. UTC+3, ο χρήστης Steven D'Aprano έγραψε: On Wed, 28 Aug 2013 05:17:34 -0700, Ferrous Cranus wrote: As i have pointed out i as the owner of the accoutn have read and write perimssion bot at www/ and www/cgi-bin i also chnage the filename and still cant write to the file. If you type filenames as carelessly as you type requests for help, who knows what file name you are actually trying to open? Or to put it another way... If yuo tpye filnaems as carlesl yas y outype reqets for help, woh knwos wha tfile nmae oyu ar eactaly tying to oep n? Nikos, my Greek is completely non-existent, and I admire you for learning a second language. I know your English is good, because I have seen you write fluent, excellent English. But if you can't be bothered to type carefully and clearly when asking questions, then how can you expect others to be bothered to read and respond to your questions? if you as experts cannot help resolve this, how me as a newbiw can? Just because your account has write permission to a location doesn't mean that the script being run by the webserver has write permission. You need to write to a location where the script has permission to write. First you need to find out what account the script is being run under -- it may be apache, or possible nobody, but I don't know. It shouldn't be root, and almost certainly isn't nikos. I'm not an expert, but a few seconds googling came up with a lot of useful looking hits. Google on what user does apache run as and do your research. This is off-topic though. This is not a beginner's guide to apache forum, if you can't solve this problem yourself you'll have to take it elsewhere. -- Steven Hi steven , sorry for the typos. you are write my script is invoked by apache web server application which it runs under account 'nobody' Here is proof of that: ni...@superhost.gr [~]# ps aux | grep Apache nikos 8531 0.0 0.0 6372 680 pts/0R+ 12:44 0:00 grep Apache ni...@superhost.gr [~]# ps aux | grep apache root 1101 0.0 0.2 65576 4168 ?Ss 08:30 0:01 /usr/local/apache/bin/httpd -k start -DSSL root 8448 0.0 0.1 65576 1700 ?S12:42 0:00 /usr/local/apache/bin/httpd -k start -DSSL nobody8449 0.0 0.2 65712 3228 ?S12:42 0:00 /usr/local/apache/bin/httpd -k start -DSSL nobody8450 0.0 0.2 65848 3348 ?S12:42 0:00 /usr/local/apache/bin/httpd -k start -DSSL nobody8451 0.0 0.2 65848 3360 ?S12:42 0:00 /usr/local/apache/bin/httpd -k start -DSSL nobody8452 0.0 0.2 65712 3340 ?S12:42 0:00 /usr/local/apache/bin/httpd -k start -DSSL nobody8453 0.0 0.2 65712 3260 ?S12:42 0:00 /usr/local/apache/bin/httpd -k start -DSSL nobody8467 0.0 0.1 65712 2356 ?S12:43 0:00 /usr/local/apache/bin/httpd -k start -DSSL nobody8468 0.0 0.1 65712 2344 ?S12:43 0:00 /usr/local/apache/bin/httpd -k start -DSSL nobody8519 0.0 0.1 65712 2344 ?S12:43 0:00 /usr/local/apache/bin/httpd -k start -DSSL nikos 8537 0.0 0.0 6372 684 pts/0R+ 12:44 0:00 grep apache My script were all workign in the previous VPS enviroment, the script is correct is just a few minor thing in the new VPS env that they need to be taken care of thus prohibit my script to run.. please don't give up helping me and tell me please what you want me to try. tahnk you very much. -- http://mail.python.org/mailman/listinfo/python-list
Re: [error] [client 178.59.111.223] (2)No such file or directory: exec of
This si what iam tryign now since the function ishish proposed wont help me. try: #find the needed counter for the page URL if os.path.exists( path + page ) or os.path.exists( cgi_path + page ): cur.execute('''SELECT ID FROM counters WHERE url = %s''', page ) data = cur.fetchone() #URL is unique, so should only be one except: print( repr(e) ) [Wed Aug 28 13:08:27 2013] [error] [client 108.162.231.120] Original exception was: [Wed Aug 28 13:08:27 2013] [error] [client 108.162.231.120] Traceback (most recent call last): [Wed Aug 28 13:08:27 2013] [error] [client 108.162.231.120] File /home/nikos/public_html/cgi-bin/metrites.py, line 174, in module [Wed Aug 28 13:08:27 2013] [error] [client 108.162.231.120] cur.execute('''SELECT ID FROM counters WHERE url = %s''', page ) [Wed Aug 28 13:08:27 2013] [error] [client 108.162.231.120] File /usr/local/bin/python/lib/python3.3/site-packages/pymysql/cursors.py, line 108, in execute [Wed Aug 28 13:08:27 2013] [error] [client 108.162.231.120] query = query % escaped_args [Wed Aug 28 13:08:27 2013] [error] [client 108.162.231.120] TypeError: unsupported operand type(s) for %: 'bytes' and 'str' [Wed Aug 28 13:08:27 2013] [error] [client 108.162.231.120] [Wed Aug 28 13:08:27 2013] [error] [client 108.162.231.120] During handling of the above exception, another exception occurred: [Wed Aug 28 13:08:27 2013] [error] [client 108.162.231.120] [Wed Aug 28 13:08:27 2013] [error] [client 108.162.231.120] Traceback (most recent call last): [Wed Aug 28 13:08:27 2013] [error] [client 108.162.231.120] File /home/nikos/public_html/cgi-bin/metrites.py, line 177, in module [Wed Aug 28 13:08:27 2013] [error] [client 108.162.231.120] print( repr(e) ) [Wed Aug 28 13:08:27 2013] [error] [client 108.162.231.120] NameError: name 'e' is not defined -- http://mail.python.org/mailman/listinfo/python-list
Re: [error] [client 178.59.111.223] (2)No such file or directory: exec of
Am 28.08.2013 13:55, schrieb Ferrous Cranus: Τη Τετάρτη, 28 Αυγούστου 2013 2:32:44 μ.μ. UTC+3, ο χρήστης Dave Angel έγραψε: You really have no directory in which you have write permissions? If so, perhaps you'd better solve that first. of cours ei ahve write permissions. Here: ni...@superhost.gr [~]# ls -ld www/ drwxr-x--- 4 nikos nobody 4096 Jul 13 10:33 www// ni...@superhost.gr [~]# ls -ld www/cgi-bin/ drwxr-xr-x 2 nikos nikos 4096 Aug 28 10:41 www/cgi-bin// whick make it a mysterya s to why with open(../err.out, a) as f: fails to write the file. ...maybe it's because the server is not running as user nikos? Uli -- http://mail.python.org/mailman/listinfo/python-list
Re: [error] [client 178.59.111.223] (2)No such file or directory: exec of
Τη Τετάρτη, 28 Αυγούστου 2013 4:38:02 μ.μ. UTC+3, ο χρήστης Ulrich Eckhardt έγραψε: Am 28.08.2013 13:55, schrieb Ferrous Cranus: Τη Τετάρτη, 28 Αυγούστου 2013 2:32:44 μ.μ. UTC+3, ο χρήστης Dave Angel έγραψε: You really have no directory in which you have write permissions? If so, perhaps you'd better solve that first. of cours ei ahve write permissions. Here: ni...@superhost.gr [~]# ls -ld www/ drwxr-x--- 4 nikos nobody 4096 Jul 13 10:33 www// ni...@superhost.gr [~]# ls -ld www/cgi-bin/ drwxr-xr-x 2 nikos nikos 4096 Aug 28 10:41 www/cgi-bin// whick make it a mysterya s to why with open(../err.out, a) as f: fails to write the file. ...maybe it's because the server is not running as user nikos? Uli Yes Uli, the script metrits.py is being invoked by Apache Web Server which in turn runs under user Nobody. So, that mean that? user 'nobody' has no write permission to /home/nikos folder? -- http://mail.python.org/mailman/listinfo/python-list
Re: [error] [client 178.59.111.223] (2)No such file or directory: exec of
On 28/8/2013 07:38, Ferrous Cranus wrote: no this is the general error log apache produces for all the server. Is there a way to grep error logging info, pertainign only to my specific nikos account or my superhost.gr domain? I now nothing about Apache logs, but how about grepping the client url ? [client 108.162.231.120] I still don't understand why you don't find or create a directory that nobody has write access to, so you can be more flexible about what information you log. Or strip the problem down to a simple page that displays what print emits in a simple form. -- DaveA -- http://mail.python.org/mailman/listinfo/python-list
RE: [error] [client 178.59.111.223] (2)No such file or directory: exec of
Ferrous Cranus wrote: Yes Uli, the script metrits.py is being invoked by Apache Web Server which in turn runs under user Nobody. So, that mean that? user 'nobody' has no write permission to /home/nikos folder? Yes. You should make it group writable with nobody as the group. Use chmod and chown to change permissions and owners (i.e. groups). As a last resort (for testing purposes only!) you can set the directory world writable, but then *anyone* with access to that host can write/delete/destroy the contents of that directory. This is obviously very insecure and not a good idea. But if you are only trying to get a quick error message then it might work for you. Normally I would have thought you would have a public_html or www directory in your home folder that would be readable/writable to the web server (and where you should write). ~Ramit This email is confidential and subject to important disclaimers and conditions including on offers for the purchase or sale of securities, accuracy and completeness of information, viruses, confidentiality, legal privilege, and legal entity disclaimers, available at http://www.jpmorgan.com/pages/disclosures/email. -- http://mail.python.org/mailman/listinfo/python-list
Re: [error] [client 178.59.111.223] (2)No such file or directory: exec of
On Wed, 28 Aug 2013 18:44:28 +, Prasad, Ramit wrote: Normally I would have thought you would have a public_html or www directory in your home folder that would be readable/writable to the web server (and where you should write). I expect that he does. But Nikos has tried writing to the Nikos home directory, and to .. (the parent directory). I don't believe he has tried writing to . (the current directory), or to /tmp. I'm not an expert, but I expect that Apache should be able to write to one of those. And if not, he has root on his system, he can simply create a writable directory and write to that. I expect that there are security implications of having a directories writable to the webserver user, but temporarily creating one for a quick debugging aid should be okay. -- Steven -- http://mail.python.org/mailman/listinfo/python-list
Re: [error] [client 178.59.111.223] (2)No such file or directory: exec of
On Thu, Aug 29, 2013 at 4:44 AM, Prasad, Ramit ramit.pra...@jpmorgan.com.dmarc.invalid wrote: Normally I would have thought you would have a public_html or www directory in your home folder that would be readable/writable to the web server (and where you should write). No, a normal setup would have that world-readable but not writable. That way, even if an exploit is found in your web site that lets an attacker write files, s/he can't upload more files to the web server's directory and start running them. A directory writable by the web server might be /tmp. ChrisA -- http://mail.python.org/mailman/listinfo/python-list
Re: [error] [client 178.59.111.223] (2)No such file or directory: exec of
On Wed, Aug 28, 2013 at 6:49 PM, Steven D'Aprano steve+comp.lang.pyt...@pearwood.info wrote: On Wed, 28 Aug 2013 18:44:28 +, Prasad, Ramit wrote: Normally I would have thought you would have a public_html or www directory in your home folder that would be readable/writable to the web server (and where you should write). I expect that he does. But Nikos has tried writing to the Nikos home directory, and to .. (the parent directory). I don't believe he has tried writing to . (the current directory), or to /tmp. I'm not an expert, but I expect that Apache should be able to write to one of those. And if not, he has root on his system, he can simply create a writable directory and write to that. I expect that there are security implications of having a directories writable to the webserver user, but temporarily creating one for a quick debugging aid should be okay. -- Steven -- http://mail.python.org/mailman/listinfo/python-list This thread follows well travelled grounds from several of the previous Nikos appearances here. He seems to have problems grasping permissions as they relate to apache. He seems to demand cook book answers as compared to understanding the issues. At any rate, isn't this stuff really something that the Web Server company should be helping him with? Its their server, they know how it is configured, and they can quickly look in his directories to figure out permissions related issues. -- Joel Goldstick http://joelgoldstick.com -- http://mail.python.org/mailman/listinfo/python-list
Re: [error] [client 178.59.111.223] (2)No such file or directory: exec of
On Wed, 28 Aug 2013 06:11:13 -0700, Ferrous Cranus wrote: This si what iam tryign now since the function ishish proposed wont help me. I see that your apology for careless writing didn't last very long. [...] except: print( repr(e) ) What is the value of e here, and where is it defined? Let's look at the error in your log file: [Wed Aug 28 13:08:27 2013] [error] [client 108.162.231.120] print( repr(e) ) [Wed Aug 28 13:08:27 2013] [error] [client 108.162.231.120] NameError: name 'e' is not defined Did you bother to read the error before asking for help? Variable 'e' is not defined. Perhaps you should define it? -- Steven -- http://mail.python.org/mailman/listinfo/python-list
Re: [error] [client 178.59.111.223] (2)No such file or directory: exec of
On Wed, 28 Aug 2013 18:56:56 -0400, Joel Goldstick wrote: At any rate, isn't this stuff really something that the Web Server company should be helping him with? Its their server, they know how it is configured, and they can quickly look in his directories to figure out permissions related issues. Perhaps. But Nikos is reporting that his log file shows entries from all the other websites on the server, which doesn't sound good to me. Surely any decent, competent web server company would be able to ensure that each customer sees only their own log entries? -- Steven -- http://mail.python.org/mailman/listinfo/python-list
Re: [error] [client 178.59.111.223] (2)No such file or directory: exec of
On 28Aug2013 05:48, Nikos nikos.gr...@gmail.com wrote: | Hi steven , sorry for the typos. | you are write my script is invoked by apache web server application which it runs under account 'nobody' [...] | nobody8449 0.0 0.2 65712 3228 ?S12:42 0:00 /usr/local/apache/bin/httpd -k start -DSSL [...] | My script were all workign in the previous VPS enviroment, the script is correct is just a few minor thing in the new VPS env that they need to be taken care of thus prohibit my script to run.. Your previous VPS used suexec in the Apache. This one does not. Cheers, -- Cameron Simpson c...@zip.com.au Think positively, act positively, and never leave fingerprints. - Robert Sneddon -- http://mail.python.org/mailman/listinfo/python-list
Re: [error] [client 178.59.111.223] (2)No such file or directory: exec of
On 28Aug2013 18:44, Prasad, Ramit ramit.pra...@jpmorgan.com.dmarc.invalid wrote: | Ferrous Cranus wrote: | Yes Uli, the script metrits.py is being invoked by Apache Web Server which in turn runs under user | Nobody. | So, that mean that? user 'nobody' has no write permission to /home/nikos folder? As Ramit says, yes. Your own directory listing earlier showed r-x for the group nobody; that says no write. The file was the same: r--. | Yes. You should make it group writable with nobody as the group. Use chmod and chown | to change permissions and owners (i.e. groups). To be explicit: chgrp nobody the-file chmod g+w the-file | Normally I would have thought you would have a public_html or www directory in your | home folder that would be readable/writable to the web server (and where you should | write). Readable, yes. Writable? Generally mad. Apaches are often configured to run as nobody or nofiles specificly to ensure that it cannot write to stuff. The last thing you want is to have the website's files writable by the apache; it is asking for defacements and other hacks. Nikos should make a specific directory for these files and give ONLY THAT write permission for nobody. And then use a full pathname to the directory in his CGI script - a relative path makes ill founded assumptions about the current working directory of the script. Cheers, -- Cameron Simpson c...@zip.com.au A gentleman does not go motoring about after dark. - J. Lucas -- http://mail.python.org/mailman/listinfo/python-list
Re: [error] [client 178.59.111.223] (2)No such file or directory: exec of
On 28Aug2013 12:11, Steven D'Aprano steve+comp.lang.pyt...@pearwood.info wrote: | On Wed, 28 Aug 2013 01:46:01 -0700, Ferrous Cranus wrote: | Also many times when i try to view the error_log by | tail -F /usr/local/apache/logs/error_log | | i get realtime scrolling of other joomla webistes pho errors and i have | hard time trackign my own webistes erros. | | is ther a work around for that? | | That's an apache logging issue, not Python, and I don't know enough about | apache to do more than guess that there probably is a solution but I have | no idea what it is. Normal practice is to specify vhost specific log paths inside each website's VirtualHost clause, thus splitting the log for each website out into separate files. http://httpd.apache.org/docs/2.2/mod/core.html#virtualhost Notice the ErrorLog directive inside the clause. Cheers, -- Cameron Simpson c...@zip.com.au What the hell are we supposed to use, man -- harsh language? Flame units only. - _Aliens_ -- http://mail.python.org/mailman/listinfo/python-list
Re: [error] [client 178.59.111.223] (2)No such file or directory: exec of
Τη Πέμπτη, 29 Αυγούστου 2013 1:56:55 π.μ. UTC+3, ο χρήστης Steven D'Aprano έγραψε: On Wed, 28 Aug 2013 06:11:13 -0700, Ferrous Cranus wrote: This si what iam tryign now since the function ishish proposed wont help me. I see that your apology for careless writing didn't last very long. [...] except: print( repr(e) ) What is the value of e here, and where is it defined? Let's look at the error in your log file: [Wed Aug 28 13:08:27 2013] [error] [client 108.162.231.120] print( repr(e) ) [Wed Aug 28 13:08:27 2013] [error] [client 108.162.231.120] NameError: name 'e' is not defined Did you bother to read the error before asking for help? Variable 'e' is not defined. Perhaps you should define it? Yes indeed , that was a a syntax error by me: try: #find the needed counter for the page URL if os.path.exists( path + page ) or os.path.exists( cgi_path + page ): cur.execute('''SELECT ID FROM counters WHERE url = %s''', page ) data = cur.fetchone()#URL is unique, so should only be one except Exception as e: con.rollback()#something failed, rollback the entire transaction print( repr(e) ) outputs: [Thu Aug 29 04:18:04 2013] [error] [client 108.162.229.127] File /home/nikos/public_html/cgi-bin/metrites.py, line 206, in module [Thu Aug 29 04:18:04 2013] [error] [client 108.162.229.127] cur.execute('''SELECT hits FROM counters WHERE url = %s''', page ) [Thu Aug 29 04:18:04 2013] [error] [client 108.162.229.127] File /usr/local/bin/python/lib/python3.3/site-packages/pymysql/cursors.py, line 108, in execute [Thu Aug 29 04:18:04 2013] [error] [client 108.162.229.127] query = query % escaped_args [Thu Aug 29 04:15:20 2013] [error] [client 141.101.98.154] File /home/nikos/public_html/cgi-bin/metrites.py, line 206, in module [Thu Aug 29 04:15:20 2013] [error] [client 141.101.98.154] cur.execute('''SELECT hits FROM counters WHERE url = %s''', page ) [Thu Aug 29 04:15:20 2013] [error] [client 141.101.98.154] File /usr/local/bin/python/lib/python3.3/site-packages/pymysql/cursors.py, line 108, in execute [Thu Aug 29 04:15:20 2013] [error] [client 141.101.98.154] query = query % escaped_args [Thu Aug 29 04:15:20 2013] [error] [client 141.101.98.154] TypeError: unsupported operand type(s) for %: 'bytes' and 'str' Now at least 'superhost.gr' displays the error when one by browser http://superhost.gr -- http://mail.python.org/mailman/listinfo/python-list
Re: [error] [client 178.59.111.223] (2)No such file or directory: exec of
Τη Πέμπτη, 29 Αυγούστου 2013 3:59:49 π.μ. UTC+3, ο χρήστης Cameron Simpson έγραψε: To be explicit: chgrp nobody the-file chmod g+w the-file Hello Cameron, ni...@superhost.gr [~/www]# touch err.out ni...@superhost.gr [~/www]# ls -l err.out -rw-rw-r-- 1 nikos nikos 0 Aug 29 04:26 err.out ni...@superhost.gr [~/www]# chgrp nobody err.out chgrp: changing group of `err.out': Operation not permitted As you can see the system does not let me alter even the groupname of a newly created text file. As, for the 'suexec' that you mentioned in another ;post of yours, old VPS had it enabled yes, the new one does not. Should i ask them to enable it back? Would it help if we enabled it back? -- http://mail.python.org/mailman/listinfo/python-list
Re: [error] [client 178.59.111.223] (2)No such file or directory: exec of
Στις 29/8/2013 7:29 πμ, ο/η Ferrous Cranus έγραψε: Τη Πέμπτη, 29 Αυγούστου 2013 3:59:49 π.μ. UTC+3, ο χρήστης Cameron Simpson έγραψε: To be explicit: chgrp nobody the-file chmod g+w the-file Hello Cameron, ni...@superhost.gr [~/www]# touch err.out ni...@superhost.gr [~/www]# ls -l err.out -rw-rw-r-- 1 nikos nikos 0 Aug 29 04:26 err.out ni...@superhost.gr [~/www]# chgrp nobody err.out chgrp: changing group of `err.out': Operation not permitted As you can see the system does not let me alter even the groupname of a newly created text file. As, for the 'suexec' that you mentioned in another ;post of yours, old VPS had it enabled yes, the new one does not. Should i ask them to enable it back? Would it help if we enabled it back? Perhaps 'suexec' would allow Apache(running under user nobody) to switch to another more privileged user prior of writing to '/home/nikos/www/err.out' -- What is now proved was at first only imagined! -- http://mail.python.org/mailman/listinfo/python-list
Re: [error] [client 178.59.111.223] (2)No such file or directory: exec of
Στις 27/8/2013 3:52 μμ, ο/η Ferrous Cranus έγραψε: I think that something iam missing in the new VPS implementation concerning my python web page. After: tail -F /usr/local/apache/logs/error_log [Tue Aug 27 12:49:52 2013] [error] [client 178.59.111.223] (2)No such file or directory: exec of '/home/nikos/public_html/cgi-bin/metrites.py' failed [Tue Aug 27 12:49:52 2013] [error] [client 178.59.111.223] Premature end of script headers: metrites.py I do not understand what this type of error is trying to say. Okey it was the python path (shebang that was causing this) Now i have correct it from /usr/local/bin/python3 = /usr/bin/python System has beens etup this way to point directly to python 3.3.2 in the new VPS. Admin setit up that way hwile in the old one was different. But i cannot overocme thjis: [Tue Aug 27 13:02:57 2013] [error] [client 110.202.175.189] Error in sys.excepthook: [Tue Aug 27 13:02:57 2013] [error] [client 110.202.175.189] ValueError: underlying buffer has been detached [Tue Aug 27 13:02:57 2013] [error] [client 110.202.175.189] [Tue Aug 27 13:02:57 2013] [error] [client 110.202.175.189] Original exception was: [Tue Aug 27 13:02:57 2013] [error] [client 110.202.175.189] Traceback (most recent call last): [Tue Aug 27 13:02:57 2013] [error] [client 110.202.175.189] File /home/nikos/public_html/cgi-bin/metrites.py, line 169, in module [Tue Aug 27 13:02:57 2013] [error] [client 110.202.175.189] cur.execute('''SELECT ID FROM counters WHERE url = %s''', page ) [Tue Aug 27 13:02:57 2013] [error] [client 110.202.175.189] File /usr/local/bin/python/lib/python3.3/site-packages/pymysql/cursors.py, line 108, in execute [Tue Aug 27 13:02:57 2013] [error] [client 110.202.175.189] query = query % escaped_args [Tue Aug 27 13:02:57 2013] [error] [client 110.202.175.189] TypeError: unsupported operand type(s) for %: 'bytes' and 'str' -- What is now proved was at first only imagined! -- http://mail.python.org/mailman/listinfo/python-list
Re: [error] [client 178.59.111.223] (2)No such file or directory: exec of
Στις 27/8/2013 4:05 μμ, ο/η Ferrous Cranus έγραψε: Στις 27/8/2013 3:52 μμ, ο/η Ferrous Cranus έγραψε: I think that something iam missing in the new VPS implementation concerning my python web page. After: tail -F /usr/local/apache/logs/error_log [Tue Aug 27 12:49:52 2013] [error] [client 178.59.111.223] (2)No such file or directory: exec of '/home/nikos/public_html/cgi-bin/metrites.py' failed [Tue Aug 27 12:49:52 2013] [error] [client 178.59.111.223] Premature end of script headers: metrites.py I do not understand what this type of error is trying to say. Okey it was the python path (shebang that was causing this) Now i have correct it from /usr/local/bin/python3 = /usr/bin/python System has beens etup this way to point directly to python 3.3.2 in the new VPS. Admin setit up that way hwile in the old one was different. But i cannot overocme thjis: [Tue Aug 27 13:02:57 2013] [error] [client 110.202.175.189] Error in sys.excepthook: [Tue Aug 27 13:02:57 2013] [error] [client 110.202.175.189] ValueError: underlying buffer has been detached [Tue Aug 27 13:02:57 2013] [error] [client 110.202.175.189] [Tue Aug 27 13:02:57 2013] [error] [client 110.202.175.189] Original exception was: [Tue Aug 27 13:02:57 2013] [error] [client 110.202.175.189] Traceback (most recent call last): [Tue Aug 27 13:02:57 2013] [error] [client 110.202.175.189] File /home/nikos/public_html/cgi-bin/metrites.py, line 169, in module [Tue Aug 27 13:02:57 2013] [error] [client 110.202.175.189] cur.execute('''SELECT ID FROM counters WHERE url = %s''', page ) [Tue Aug 27 13:02:57 2013] [error] [client 110.202.175.189] File /usr/local/bin/python/lib/python3.3/site-packages/pymysql/cursors.py, line 108, in execute [Tue Aug 27 13:02:57 2013] [error] [client 110.202.175.189] query = query % escaped_args [Tue Aug 27 13:02:57 2013] [error] [client 110.202.175.189] TypeError: unsupported operand type(s) for %: 'bytes' and 'str' someone please? -- What is now proved was at first only imagined! -- http://mail.python.org/mailman/listinfo/python-list
Re: [error] [client 178.59.111.223] (2)No such file or directory: exec of
[Tue Aug 27 13:02:57 2013] [error] [client 110.202.175.189] Error in sys.excepthook: [Tue Aug 27 13:02:57 2013] [error] [client 110.202.175.189] ValueError: underlying buffer has been detached [Tue Aug 27 13:02:57 2013] [error] [client 110.202.175.189] [Tue Aug 27 13:02:57 2013] [error] [client 110.202.175.189] Original exception was: [Tue Aug 27 13:02:57 2013] [error] [client 110.202.175.189] Traceback (most recent call last): [Tue Aug 27 13:02:57 2013] [error] [client 110.202.175.189] File /home/nikos/public_html/cgi-bin/metrites.py, line 169, in module [Tue Aug 27 13:02:57 2013] [error] [client 110.202.175.189] cur.execute('''SELECT ID FROM counters WHERE url = %s''', page ) [Tue Aug 27 13:02:57 2013] [error] [client 110.202.175.189] File /usr/local/bin/python/lib/python3.3/site-packages/pymysql/cursors.py, line 108, in execute [Tue Aug 27 13:02:57 2013] [error] [client 110.202.175.189] query = query % escaped_args [Tue Aug 27 13:02:57 2013] [error] [client 110.202.175.189] TypeError: unsupported operand type(s) for %: 'bytes' and 'str' I quote from a Python 3 Guide [http://python.about.com/od/python30/ss/30_strings_3.htm]: The two data types, str and bytes, are mutually exclusive. One cannot legally combine them into one call. With the distinction between text and data, therefore, comes the need to convert between them. -- http://mail.python.org/mailman/listinfo/python-list
Re: [error] [client 178.59.111.223] (2)No such file or directory: exec of
Στις 27/8/2013 4:59 μμ, ο/η ishish έγραψε: [Tue Aug 27 13:02:57 2013] [error] [client 110.202.175.189] Error in sys.excepthook: [Tue Aug 27 13:02:57 2013] [error] [client 110.202.175.189] ValueError: underlying buffer has been detached [Tue Aug 27 13:02:57 2013] [error] [client 110.202.175.189] [Tue Aug 27 13:02:57 2013] [error] [client 110.202.175.189] Original exception was: [Tue Aug 27 13:02:57 2013] [error] [client 110.202.175.189] Traceback (most recent call last): [Tue Aug 27 13:02:57 2013] [error] [client 110.202.175.189] File /home/nikos/public_html/cgi-bin/metrites.py, line 169, in module [Tue Aug 27 13:02:57 2013] [error] [client 110.202.175.189] cur.execute('''SELECT ID FROM counters WHERE url = %s''', page ) [Tue Aug 27 13:02:57 2013] [error] [client 110.202.175.189] File /usr/local/bin/python/lib/python3.3/site-packages/pymysql/cursors.py, line 108, in execute [Tue Aug 27 13:02:57 2013] [error] [client 110.202.175.189] query = query % escaped_args [Tue Aug 27 13:02:57 2013] [error] [client 110.202.175.189] TypeError: unsupported operand type(s) for %: 'bytes' and 'str' I quote from a Python 3 Guide [http://python.about.com/od/python30/ss/30_strings_3.htm]: The two data types, str and bytes, are mutually exclusive. One cannot legally combine them into one call. With the distinction between text and data, therefore, comes the need to convert between them. So, in this line: cur.execute('''SELECT ID FROM counters WHERE url = %s''', page ) the variable 'page' needs conversion to what? all that is stores is the location of a file path = '/home/nikos/public_html/' page = form.getvalue('page') if not page and os.path.exists( file ): # it is an html template page = file.replace( path, '' ) So chnage it to what? -- What is now proved was at first only imagined! -- http://mail.python.org/mailman/listinfo/python-list
Re: [error] [client 178.59.111.223] (2)No such file or directory: exec of
Am 27.08.2013 16:04, schrieb Ferrous Cranus: Στις 27/8/2013 4:59 μμ, ο/η ishish έγραψε: [Tue Aug 27 13:02:57 2013] [error] [client 110.202.175.189] Error in sys.excepthook: [Tue Aug 27 13:02:57 2013] [error] [client 110.202.175.189] ValueError: underlying buffer has been detached [Tue Aug 27 13:02:57 2013] [error] [client 110.202.175.189] [Tue Aug 27 13:02:57 2013] [error] [client 110.202.175.189] Original exception was: [Tue Aug 27 13:02:57 2013] [error] [client 110.202.175.189] Traceback (most recent call last): [Tue Aug 27 13:02:57 2013] [error] [client 110.202.175.189] File /home/nikos/public_html/cgi-bin/metrites.py, line 169, in module [Tue Aug 27 13:02:57 2013] [error] [client 110.202.175.189] cur.execute('''SELECT ID FROM counters WHERE url = %s''', page ) [Tue Aug 27 13:02:57 2013] [error] [client 110.202.175.189] File /usr/local/bin/python/lib/python3.3/site-packages/pymysql/cursors.py, line 108, in execute [Tue Aug 27 13:02:57 2013] [error] [client 110.202.175.189] query = query % escaped_args [Tue Aug 27 13:02:57 2013] [error] [client 110.202.175.189] TypeError: unsupported operand type(s) for %: 'bytes' and 'str' I quote from a Python 3 Guide [http://python.about.com/od/python30/ss/30_strings_3.htm]: The two data types, str and bytes, are mutually exclusive. One cannot legally combine them into one call. With the distinction between text and data, therefore, comes the need to convert between them. So, in this line: cur.execute('''SELECT ID FROM counters WHERE url = %s''', page ) the variable 'page' needs conversion to what? all that is stores is the location of a file path = '/home/nikos/public_html/' page = form.getvalue('page') if not page and os.path.exists( file ): # it is an html template page = file.replace( path, '' ) So chnage it to what? -- What is now proved was at first only imagined! The error occurs in file /usr/local/bin/python/lib/python3.3/site-packages/pymysql/cursors.py, line 108, in execute query = query % escaped_args You can check the actual values and data types using: print repr(query) print type(query) print repr(escaped_args) print type(escaped_args) Always useful is a proper exception handling using try:/except: -- http://mail.python.org/mailman/listinfo/python-list
Re: [error] [client 178.59.111.223] (2)No such file or directory: exec of
On Tue, 27 Aug 2013 18:04:23 +0300, Ferrous Cranus wrote: So, in this line: cur.execute('''SELECT ID FROM counters WHERE url = %s''', page ) the variable 'page' needs conversion to what? You tell us. You want to be a programmer, *you* need to do the programming, and not just keep asking others to solve every single bug. You have been given all the clues to solve this problem. Start by checking what the type of 'page' is, then decide what it ought to be. Hint: you can use print(type(page), file=open('path/to/some/file', 'w')) to see the type of the variable 'page' without displaying it on your website. all that is stores is the location of a file path = '/home/nikos/public_html/' page = form.getvalue('page') And what result does form.getvalue return? What is its type? Is it a list, a tuple, a dict, a bytes object, a float, a str object, something else? DON'T GUESS, and don't assume, find out for sure, by inspecting the result. if not page and os.path.exists( file ): # it is an html template page = file.replace( path, '' ) So chnage it to what? What do you think you need to change it to? Pick one: 1) bytes 2) an integer 3) a string 4) a list of floats 5) something else -- Steven -- http://mail.python.org/mailman/listinfo/python-list