[pywin32-checkins] pywin32/win32/Demos win32fileDemo.py,1.6,1.7
OLD project page for the Python extensions for Windows
Brought to you by:
mhammond
From: Mark H. <mha...@us...> - 2008-12-11 06:58:27
|
Update of /cvsroot/pywin32/pywin32/win32/Demos In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv1043/win32/Demos Modified Files: win32fileDemo.py Log Message: Use .encode('ascii') to make py3k friendly Index: win32fileDemo.py =================================================================== RCS file: /cvsroot/pywin32/pywin32/win32/Demos/win32fileDemo.py,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** win32fileDemo.py 5 May 2003 01:01:20 -0000 1.6 --- win32fileDemo.py 11 Dec 2008 06:58:21 -0000 1.7 *************** *** 22,26 **** None) test_data = "Hello\0there" ! win32file.WriteFile(handle, test_data) handle.Close() # Open it for reading. --- 22,26 ---- None) test_data = "Hello\0there" ! win32file.WriteFile(handle, test_data.encode('ascii')) handle.Close() # Open it for reading. *************** *** 28,32 **** rc, data = win32file.ReadFile(handle, 1024) handle.Close() ! if data == test_data: print "Successfully wrote and read a file" os.unlink(testName) --- 28,32 ---- rc, data = win32file.ReadFile(handle, 1024) handle.Close() ! if data.decode('ascii') == test_data: print "Successfully wrote and read a file" os.unlink(testName) |