[python-win32] How can I modify owner file in windows??

Tim Golden mail at timgolden.me.uk
Tue Jul 29 12:09:23 CEST 2008


_ _ wrote:
> Hi... Thanks...
> 
> I try this but I have errors:
> 
> pywintypes.error: (1307,
> or
> pywintypes.error: (5,
> 
> I create "file1.txt" with user "user1" and I try change owner to "user2" 
> but don't work.
> "user1" and "user2" are users in domain "domain1"...
> 
> Can you help me please??


Sorry; I need to test that page some more. Use
the WMI solution; it's much easier:

<code>
import wmi

FILENAME = "c:/temp/temp.txt"
c = wmi.WMI ()
for file in c.CIM_DataFile (Name=FILENAME):
  file.TakeOwnerShip ()

</code>

TJG


More information about the python-win32 mailing list