Re: [Tutor] Return to my python26.dll & python.dll problems on bootup

2012-01-07 Thread Wayne Watson
You are right about posting here, but I was hoping someone might have related to the problem. I went to the WinAmp forum for help. But who would have guessed that WinAmp would have provided a program not ready for prime time, and nothing buy an advertisement to get you to buy the latest drivers

Re: [Tutor] making a custom file parser?

2012-01-07 Thread Lie Ryan
On 01/08/2012 04:53 AM, Alex Hall wrote: Hello all, I have a file with xml-ish code in it, the definitions for units in a real-time strategy game. I say xml-ish because the tags are like xml, but no quotes are used and most tags do not have to end. Also, comments in this file are prefaced by an a

Re: [Tutor] Subclassing Exceptions

2012-01-07 Thread Lie Ryan
On 01/07/2012 03:56 PM, Steven D'Aprano wrote: Chris Fuller wrote: You probably shouldn't inherit from SyntaxError, since it represents syntax errors in the Python code being interpreted or compiled. Any syntax error in your own data structures should be independent of SyntaxError. I'd say a s

Re: [Tutor] making a custom file parser?

2012-01-07 Thread Hugo Arts
On Sat, Jan 7, 2012 at 8:22 PM, Alex Hall wrote: > I had planned to parse myself, but am not sure how to go about it. I > assume regular expressions, but I couldn't even find the amount of > units in the file by using: > unitReg=re.compile(r"\(*)\") > unitCount=unitReg.search(fileContents) > print

Re: [Tutor] making a custom file parser?

2012-01-07 Thread Alex Hall
I had planned to parse myself, but am not sure how to go about it. I assume regular expressions, but I couldn't even find the amount of units in the file by using: unitReg=re.compile(r"\(*)\") unitCount=unitReg.search(fileContents) print "number of units: "+unitCount.len(groups()) I just get an ex

Re: [Tutor] making a custom file parser?

2012-01-07 Thread Chris Fuller
If it's unambiguous as to which tags are closed and which are not, then it's pretty easy to preprocess the file into valid XML. Scan for the naughty bits (single quotes) and insert escape characters, replace with something else, etc., then scan for the unterminated tags and throw in a "/" at t

[Tutor] making a custom file parser?

2012-01-07 Thread Alex Hall
Hello all, I have a file with xml-ish code in it, the definitions for units in a real-time strategy game. I say xml-ish because the tags are like xml, but no quotes are used and most tags do not have to end. Also, comments in this file are prefaced by an apostrophe, and there is no multi-line comme

Re: [Tutor] How to invoke different member-function according to different object?

2012-01-07 Thread Peter Otten
daedae11 wrote: > I was asked to write a program to move files between ZIP(.zip) and > TAR/GZIP(.tgz/.tar.gz) or TAR/BZIP2(.tbz/.tar.bz2) archive. > > my code is: > > > import zipfile; > import tarfile; > import os; > from os import path ; > > def showAllFiles(fileObj): > if fileObj.filena