[error] [client 178.59.111.223] (2)No such file or directory: exec of

Steven D'Aprano steve+comp.lang.python at pearwood.info
Tue Aug 27 13:07:52 EDT 2013


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



More information about the Python-list mailing list