Can't write to a directory made w/ os.makedirs

Tim Golden mail at timgolden.me.uk
Sun Jan 1 10:05:58 EST 2012


On 01/01/2012 12:05, David Goldsmith wrote:
 >> ie can the Python process creating the directories,
 >
 > Yes.
 >
 >> and a subprocess called from it create a simple file?
 >
 > No.
 >
 >> Depending on where you are in the filesystem, it may indeed
 >> be necessary to be running as administrator. But don't try
 >> to crack every security nut with an elevated sledgehammer.
 >
 > If you mean running as admin., those were my sentiments exactly.  So,
 > there isn't something specific I should be doing to assure that my
 > subproceses can write to directories?


In the general case, no. By default, a subprocess will have
the same security context as its parent. The exception is
where the parent (the Python processing invoking subprocess.call
in this example) is already impersonating a different user;
in that case, the subprocess will inherit its grandparent's
context.

But unless you're doing something very deliberate here then
I doubt if that's biting you.

Can I ask: are you absolutely certain that the processes
you're calling are doing what you think they are and failing
where you think they're failing?

TJG



More information about the Python-list mailing list