ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/ns_dev/Python/NinoCode/Tool_Box/Inpersonator.py
(Generate patch)

Comparing Python/NinoCode/Tool_Box/Inpersonator.py (file contents):
Revision 743 by ninoborges, Sat May 5 04:21:19 2012 UTC vs.
Revision 744 by nino.borges, Tue Apr 13 21:40:41 2021 UTC

# Line 22 | Line 22 | class Impersonate:
22          self.handle.Close() # Guarantees cleanup
23  
24   if __name__=='__main__':
25 <    print "Right now I'm %s" % win32api.GetUserName()
25 >    print("Right now I'm %s" % win32api.GetUserName())
26      a = Impersonate("wsburrou", "/.,zxc';lasdkf")
27      try:
28          a.logon() #become the user
29          try:
30              # Do whatever you need to do
31 <            print "Now I'm %s"% win32api.GetUserName() # show that I'm someone else
31 >            print("Now I'm %s"% win32api.GetUserName()) # show that I'm someone else
32          finally:
33              a.logoff() # Ensure return-to-normal no matter what
34      except:
35 <        print 'Exception:', sys.exc_type, sys.exc_value
36 <    print "I'm now exiting as %s" % win32api.GetUserName()
35 >        print('Exception:', sys.exc_info()[0], sys.exc_info()[1])
36 >    print("I'm now exiting as %s" % win32api.GetUserName())

Diff Legend

Removed lines
+ Added lines
< Changed lines (old)
> Changed lines (new)