Hello,
I've been on this forum for some time and from what I heard, wrong Versions of Python/wxPython are the main reasons for bug-reports.
Also, I found the system_check.py is a littlebit silent (especially for Winodws-User), so I start a small project and try to change it with the folowing objectives in mind:
Printing the log to the screen, in addition to printing the file and reatining all other functionality
Printing out where the logfile can be found, or an error if it could not been created
Clearly pionting out when wxPython is missing or the Python/wx.Python Version does not fit the requirements (yes, a simple if-not-equal)
Adding fork-specific checks (like pointing out, that setup.py obviously was not run for Traipse)
So far, I have done the folowing steps:
Added a list named "log", to contain the string's and changed all self.log_file.write commands to self.log.append (see todo)
Placed the file open and write commands near the end of system_check.start(), and made a new write command.
Replaced the variable log_file with log_file_name, but kept log_file as name for the file object (so I can use the name of the file in the following operation)
Added a message containing the absolute path and name of the logfile to the log, after the close command
Added a print_log() function and called it at the end of the __main__ to print the log (with the info about the file) to the screen
todo:
Making a real exceptionhandling for the writing of the logfile
Replacing the list with a string, so I don't need the ugly workaround with the two for..in and the temp_output
Placing the entire writing in a seperate function and making the filename and -path fields of the class with it's values (or the defaults) set by __init__.
Changing the Python and wx.Python version checks in a way, that the log clearly says when the versions are not right. somethin like "...Version does not match recommended; Please use recommende Version" or perhaps something like "OpenRPG will NOT run with the most recent Version of ...)"
Adding a fork-specefic test, perhaps in a seperate file? (Maybe even including the previous step in this, as their requirements will change/drift with Pious Paladin)
I used the system-check.py from Traipse, but there are pratically no differences in the files.
The modified system_check.py so far:
Code:
#!/usr/bin/env python
import sys
import os
import time
import platform
import wx
#This sets the install Dir, and Enviromental variables
import location
import orpg.orpg_version
class system_check:
def start(self,log_file_name='openrpg_sysinfo.txt'):
self.log = list()
self.log.append("OpenRPG System Info " + time.strftime( '%m-%d-%y', time.localtime( time.time() ) ))
self.check_openrpg()
self.check_py()
self.check_wxpython()
self.check_platform()
#writing the logfile
self.log_file = open(log_file_name,'w')
for row in self.log:
self.log_file.write(row)
self.log_file.close()
self.log.append("If nothing went wrong, this log should have been wirtten to " + os.getcwd() + os.sep + log_file_name)
def check_wxpython(self):
self.log.append("\nwxPython Version: " + wx.__version__)
def check_py(self):
self.log.append("\nPython: " + sys.version)
def check_platform(self):
self.log.append("\nPlatform: " + platform.platform())
def check_openrpg(self):
self.log.append("\nOpenRPG Version: " + orpg.orpg_version.VERSION)
self.log.append("\nOpenRPG Build: " + orpg.orpg_version.BUILD)
def print_log(self):
self.temp_output = ""
for row in self.log:
self.temp_output += row
print(self.temp_output)
if __name__ == "__main__":
syscheck = system_check()
syscheck.start()
syscheck.print_log()
raw_input("Printed out a datafile called openrpg_sysinfo.txt\nPress <enter> to exit!")