Open main menu

CDOT Wiki β

Changes

Run tests.py

630 bytes removed, 18:45, 21 December 2009
m
no edit summary
import time
import syck
import sys
import ts
import os
from os.path import join, getsize
import stat
import string
import urlparse
#import killableprocess #Python 2.3
resp = raw_input("Do you want the directory to be created (y/n)? ")
# For some reason, it complains when I use string.lowercase, therefore, I have to check # the user input in a more inefficient way. If the user chooses Y/y, a missing dir will # be created. However, if the user chooses N/n, an error message is thrown to let the user # know of the missing directory so that he/she can create it manually. Program should exit # but it doesn't with sys.exit. Why??? while resp not in (resp == "y") or not (resp == , "Y") or not (resp == , "n") or not (resp == , "N"): if (resp == raw_input("Do you want the directory to be created (y/n)? ") or sys.stdout.flush() if resp == in ("y", "Y"): print "creating dir..." dirname = head os.mkdir(dirname) print "Dir %s is created" % dirname break elif resp in (resp == "n") or (resp == , "N"): #killProcess.kill() error = "\nError... Please check that" + head + " is created or exist or change path in paths.py to correct path" sys.exit(error) #why doesn't this exit the program? break else: resp = raw_input("Do you want the directory to be created (y/n)? ") sys.stdout.flush()
elif os.path.exists(head):
for root, dirs, files in os.walk(paths.BASE_PROFILE_DIR):
print root, "consumes",
print sum(os.path.getsize(os.path.join(root, name)) for name in files),
print "bytes in", len(files), "non-directory files"
if 'CVS' in dirs:
dirs.remove('CVS') # don't visit CVS directories
if sum(os.path.getsize(os.path.join(root, name)) for name in files) == 0:
#killProcess.kill()
validatePaths = False
print "checking... Exist: %s" %file_path[0]
sys.stdout.flush()
validateURLS = True
if not validateURLS:
sys.exit(error) # it doesn't exit the program, why?
if return validateURLS and validatePaths: return 1 else: return 0 return 0
####
1
edit