View unanswered posts | View active topics It is currently Thu Mar 28, 2024 5:41 pm



Post new topic Reply to topic  [ 4 posts ] 
 New system_check.py 
Author Message

Joined: Fri Jun 25, 2010 12:54 am
Posts: 18
Post New system_check.py
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!")


Mon Sep 06, 2010 9:01 pm
Profile
User avatar

Joined: Wed Dec 09, 2009 9:39 pm
Posts: 712
Post Re: New system_check.py
Don't import wx at the top. That is one thing that I have been wanting to change. Import wx in a try and except in case someone does not have wx.Python installed. If they don't have wx.Python installed the script will fail with no answer.

_________________
I ate your Death Knell.
The Traipse Movement
Please show your support for Traipse OpenRPG http://www.facebook.com/MadMathLabs
Send me Traipse OpenRPG Ideas, Bugs, Complaints, Praises here: https://getsatisfaction.com/mml


Mon Sep 06, 2010 9:07 pm
Profile YIM WWW

Joined: Thu Dec 10, 2009 6:37 am
Posts: 335
Post Re: New system_check.py
We don't get too much feed back but it seems like once a year we've accumulated enough to see what the big bugs are among those that we do get reported and we then try to fix them. Things have been down as far as my own development goes for the last three months because my group hasn't been able to play much and I am testing new features I have added and recently released in a dev version. I'd like to get shared data nodes working next.

Ideally we'd like to fix it so the 1.8.11.0 wxPython does work with OpenRPG -- probably by removing the coloured tabs option which alwasy seemed a bit silly and pointless to me but then I don't know its history.


Tue Sep 07, 2010 11:43 pm
Profile
User avatar

Joined: Wed Dec 09, 2009 9:39 pm
Posts: 712
Post Re: New system_check.py
I am replacing wx.Python with PyQt. ;)

_________________
I ate your Death Knell.
The Traipse Movement
Please show your support for Traipse OpenRPG http://www.facebook.com/MadMathLabs
Send me Traipse OpenRPG Ideas, Bugs, Complaints, Praises here: https://getsatisfaction.com/mml


Wed Sep 08, 2010 4:39 am
Profile YIM WWW
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 4 posts ] 


Who is online

Users browsing this forum: No registered users and 30 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by Vjacheslav Trushkin for Free Forums/DivisionCore.