Τη Τρίτη, 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