Since the archive bit is Windows-specific, your first place to check is
Mark Hammond's Python for Windows Extensions (aka win32all). It's a
quick and painless install; grab it here:
http://python.net/crew/skippy/win32/
Once you have that installed, look in the PyWin32.chm help file for the
function calls you need. If the documentation is too sparse, check
MSDN or google it.
For what you're trying to do:
import win32file
import win32con
def togglefileattribute(filename, fileattribute, value):
"""Turn a specific file attribute on or off, leaving the other
attributes intact.
"""
bitvector = win32file.GetFileAttributes(filename)
if value:
bitvector |= fileattribute
else:
bitvector &= ~fileattribute
win32file.SetFileAttributes(filename, bitvector)
# Sample usage:
togglefileattribute('foo.txt', win32con.FILE_ATTRIBUTE_ARCHIVE, True)