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

import re, os, glob, time
os.chdir('/Software/xampp/htdocs/catalog/temp')

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?

Recommended Answers

All 3 Replies

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

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.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.