Quantcast
Channel: check if turbogears public file exists - Stack Overflow
Viewing all articles
Browse latest Browse all 3

check if turbogears public file exists

$
0
0

I am new to turbogears and have an app that I am creating with multiple directories under public/media/ballots. I need to see if a directory exists.

path = "public/media/ballots/"+ x['directoryName']#return pathif os.path.exists(path):                listing = os.listdir(path)                i=0                for infile in listing:                   #find path for ballot1, ballot2, etc from files in directory                   i +=1                   Ballot = "Ballot"+str(i)                    x['Ballot']= infile                return xelse:    return "false"

I've tried multiple ways of defining the path: "/media/ballots/", "./media/ballots/", "media/ballots". But the os.path.exists(path) always returns false. I'm not sure how TG is accessing the public files.


Viewing all articles
Browse latest Browse all 3

Latest Images

Trending Articles





Latest Images