how to read a static file in .py file using django ..

Posted by zjm1126 on Stack Overflow See other posts from Stack Overflow or by zjm1126
Published on 2010-04-21T02:52:15Z Indexed on 2010/04/21 2:53 UTC
Read the original article Hit count: 301

Filed under:
|

this is my error code:

text = open('/media/a.txt', 'rb').read()

and my perplexed is:

when i use this :

text = open('a.txt', 'rb').read()

it can be running

but when i put the 'a.txt' to the 'media' folder, i can't running ,

why ?

thanks

IOError at /
[Errno 13] file not accessible: '/media/a.txt'

© Stack Overflow or respective owner

Related posts about django

Related posts about open-file