Recent Notes

Displaying keyword search results 1 - 3
Created by Dr. Xi on June 06, 2009 18:31:44    Last update: June 25, 2012 12:37:35
You can use the system call from the os module to execute an external program: >>> import os >>> os.system(the_command_line_st... However, the path to the executable contains a space character, the system call treats the strings after the first space as arguments, causing an error. Python doc recommends the use of the subprocess module: The subprocess module provides more powerful facilities for spawning new processes and retrieving their results; using that module is preferable to using this function. For example, using wget to get the google home page: >>> from subprocess import Popen, PIPE >>> (out... or >>> import subprocess >>> subprocess.call(['cur...
Created by voodoo on February 25, 2011 14:00:41    Last update: February 25, 2011 14:03:46
Suddenly my Windows XP failed to boot with this error message on a blank screen: missing or corrupt <windows root>\system32\hal.dll I took out the hard drive, put it in a USB enclosure and attached it to another PC. Then I ran CHKDSK and it fixed some file system errors. But I did find that hal.dll was intact, so hal.dll was not missing or corrupt . It turned out that the file that was really missing was C:\boot.ini . It is a hidden file, so you have to use attrib boot.ini to see it. The file is missing if attrib boot.ini returns nothing (run in the root folder C:\). In my case I reconstructed the boot.ini file: [boot loader] timeout=30 default=multi(0)dis... and changed the attributes back...
Created by Dr. Xi on May 05, 2009 19:59:21    Last update: May 05, 2009 19:59:21
Delete a single file: >>> import os >>> file = 'myfile' >>> os.rem... Delete a directory and contents: >>> import shutil >>> dir(shutil) ['Error', ...