def images_loop(self): import time, glob while self.steps.get_current_page() == 4: for image in glob.glog("%s/pixmaps/%s/snapshot*.png" % (GLADEDIR, self.distro)): self.installing_image.set_from_file(image) time.sleep(2)
def build_graph(final_path): files = glob.glog(final_path + "*.csv") G = nx.Graph() edges = [] for filename in files: with open(final_path + filename + ".txt", 'r') as f: for l in f.readlines(): triple = json.loads(l) sub, rel, obj = triple[0], triple[1], triple[2] edges.append((sub, obj, {'relation': rel})) G.add_edges_from(edges) return G
#!/usr/bin/python import os, sys import glob # Get user feedback print "Running eps2png.py" # Get file pattern from user file_pattern = sys.argv[1:] # Compile all files that satisfy that pattern file_names = glob.glog(file_pattern) for file_name in file_names: # Give user feedback print "Processing " + file_name + "..." # Split file name into base and extension base, extension = os.path.splitext(file_name) # Make sure file is an eps file assert extension == "eps" # Specify names of files involved eps_file = base + ".eps" pdf_file = base + ".pdf" png_file = base + ".png" # Convert eps to pdf and remove eps assert os.path.exists(eps_file) command1 = "/usr/texbin/epstopdf %s" % eps_file