My program doesn't make it pass these lines on one computer:

import re, os, glob, time

file_list = glob.glob('Full-EP*.txt')
file_dict = dict([(os.stat(a_file).st_mtime, a_file) for a_file in file_list])
date_list = list([key for key, value in file_dict.items()])
s = file_dict[max(date_list)]

datePattern = re.compile(r'^Full-EP(\d{4})(\D{3})(\d{2})-(\d{2})(\d{2}).txt$')
webdate = datePattern.search(s).groups()

metadata = os.stat('WEB-Price-List.txt') 
dbdate = time.localtime(metadata.st_mtime)

print("You are using an EP file made on " + webdate[1] + " " + webdate[2] + ", " + webdate[0] + " at " + webdate[3] + ":" + webdate[4] + ".\n")
print(time.strftime("The file from Access is dated %b %d, %Y at %H:%M.", dbdate))

I compiled it as exe, so I do not have any error messages. It works everywhere I tested except on one machine running XP SP3.
Can someone point out where the program might have died silently?

7 Years
Discussion Span
Last Post by yuguang

Is the directory there and do you have access to it?

I know about that second line. I change it before it's compiled. I've also checked the directory to make sure I have permissions to it. I've made sure all the file names are correct.
Given that Python is supposed to be portable and there are no issues with the code, it must be something peculiar in the Python dependencies in the OS.

I hate to say it, but there's nothing wrong with the folder name, regex, or filenames.


Is there any way to log the errors in python? I will need to run this on someone else's computer.

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.