[python-win32] Using ctypes

2010-12-26 Thread Mico Siahaan
Hi, I am learning to use ctypes and I want to use ctypes in Win 7 to do a simple task: delete a file. I wrote: import ctypes ctypes.windll.kernel32.DeleteFileA("E:\deleteme.txt") But it failed (returned bool value 0) Please suggest what was wrong? Regards, --- Mico | [email protected]

Re: [python-win32] Using ctypes

2010-12-26 Thread Shun-ichi Goto
2010/12/27 Mico Siahaan : > import ctypes > ctypes.windll.kernel32.DeleteFileA("E:\deleteme.txt") It should be r"E:\deleteme.txt" or "E:\\deleteme.txt" -- Shun-ichi GOTO ___ python-win32 mailing list [email protected] http://mail.python.org/mailm

Re: [python-win32] Using ctypes

2010-12-26 Thread Mico Siahaan
Dear Shun-ichi, I did replace "E:\deleteme.txt" to r"E:\deleteme.txt" or to "E:\\deleteme.txt" but still failed. Thanks, --- Mico | [email protected] | @bangmico -Original Message- From: Shun-ichi Goto Sender: [email protected] Date: Mon, 27

Re: [python-win32] Using ctypes - solved

2010-12-26 Thread Mico Siahaan
Dear all, It was solved. It was because when I created the file using windows explorer "New Text Document" typed "deleteme.txt" as name, so actually the filename was "deleteme.txt.txt". Regards, --- Mico | [email protected] | @bangmico -Original Message- From: "Mico Siahaan" Se