Python Script Cannot Write to Directory

Albert Hopkins marduk at letterboxes.org
Wed Aug 4 06:57:33 CEST 2010


On Tue, 2010-08-03 at 21:01 -0700, Chris Brauchli wrote:
> Hi,
> 
> I am writing a script that, at one point, copies a file from directory
> A to directory B. Directory B can only be written to by root, but the
> script is always called with sudo, so this shouldn't be an issue, but
> it is. I have tried using shutil.copy() and calling "sudo cp " with
> os.popen to no avail. I cannot get the script to copy a file to
> directory B. The strange thing is if I run the python interpreter (as
> sudo) and type in shutil.copy it works. It also works if I try to copy
> the file to a less protected directory. It only happens when I try to
> copy a file to directory B from a python script.
> 
> Any ideas why this is happening? If more information is needed or
> something isn't clear let me know. Thanks for helping.
> 
> Chris

Code?

Traceback?




More information about the Python-list mailing list