Can't Write File

Dave Angel davea at ieee.org
Tue Nov 10 16:33:51 EST 2009


Victor Subervi wrote:
> Hi;
> I've determined the problem in a script is I can't open a file to write it:
> script = open(getpic, "w")  # where getpic is already defined
> Here are the permissions:
> -rwxr-xr-x  1 root root  4649 Nov 10 12:31 start.py
> What am I doing wrong?
> TIA,
> Victor
>
>   
Wrong?

1) you don't specify the environment, python version, OS, etc.
2) you don't show the error traceback
3) you don't indicate the value of   getpic at the time this statement 
executes
4) you don't indicate what the current working directory is, os.getcwd()
5) you don't indicate what directory the start.py is located in
6) you don't indicate which user is executing this script (only root can 
write to it)
7) you don't tell what the filename of the script is, specif. if it's 
called start.py
8) you don't say what happens if you do an open(getpic, "r"), or  
os.path.isfile(getpic)


By the time you answer each of those questions, you may notice the 
answer to your own question.

DaveA




More information about the Python-list mailing list