having issues Installing Python 2.5b3 on Windows XP
I installed python 2.5b3 on my windows XP sp2 box without any issues. I can double click the python program, and idle comes up in the command line window. However when I run python from the command line program cmd.exe, I get a pop-up window with the following error: 16 bit Windows Subsystem - The NTVDM CPU has encountered an illegal instruction. CS:020c IP:0115 OP:0f 00 00 00 00 Choose 'Close' to terminate the application. If I run python from the command line with the full path, C:\Python25\python, no problem. I checked my environment variables and they are pointing to the correct directories. I am at a loss for waht is causing the issue. Active state python 2.4 worked from the command line with no issues. I know 2.5b3 is beta, but I would like to try and get it running properly. At the very least, I would like someone to report this bug so that the final version gets fixed. Please don't say reboot. I have already tried that, same problem. I am going to try to install python 2.4 with the msi installer and see if I have the same issue with that version. If anyone else has any ideas please help. Thanks:) SA -- http://mail.python.org/mailman/listinfo/python-list
Re: having issues Installing Python 2.5b3 on Windows XP
The python 2.4 version msi did no better. Please help. I do not really want to go back to Active State Python. Thanks:) SA Bucco wrote: > I > am going to try to install python 2.4 with the msi installer and see if > I have the same issue with that version. If anyone else has any ideas > please help. -- http://mail.python.org/mailman/listinfo/python-list
Re: having issues Installing Python 2.5b3 on Windows XP
I'm getting closer now. I figured out that when I typed python in cmd.exe window it was trying to run the cygwin version of python. I removed that link and cmd.exe now finds the correct version. Therefore, this is not a bug. However, someone should add a caution in the installation instructions for those of us using cygwin on windows. Thanks:) SA -- http://mail.python.org/mailman/listinfo/python-list
List comparison help please
I am trying to compare a list of items to the list of files generated by os.listdir. I am having trouble getting this to work and think I may be going down the wrong path. Please let me know if hter is a better way to do this. THis is what I have for my class so far: import os, sys class MatchList: def __init__(self, dir, file): self.dir = os.listdir(dir) self.flist = open(file, 'r').readlines() self.matches = [] def matcher(self): #~ matches = [] for fname in self.dir: #~ print fname if fname[-4] == '.': for item in self.flist: if item == fname[:-4]: pass else: self.matches.append(fname) #~ else: #~ break #~ if self.matches == '': #~ print "Sorry, there was no match." #~ else: #~ for item in matches: #~ print item def matchedFiles(self): for item in self.matches: print item if __name__ == '__main__': dir = sys.argv[1] file = sys.argv[2] list = open(file, 'r').readlines() test = MatchList(dir, file) test.matcher() test.matchedFiles() Thanks in advance for your help. :) SA -- http://mail.python.org/mailman/listinfo/python-list
Re: List comparison help please
Simon Forman wrote: > 1) Don't use "dir", "file", and "list" as variable names, those are > already python built in objects (the dir() function, list type, and > file type, respectively.) Thanks. My own stupidity on this one. > 2) 'r' is the default for open(), omit it. "self.flist = > open(file).readlines()" > Could you clarify? Show an example. Sorry if I sound newbyish, but I am. > 5) Since you have a list of things you're matching (excluding actually) > this part: > > > for item in self.flist: > > if item == fname[:-4]: > > pass > > else: > > self.matches.append(fname) > > could become: > > if fname[:-4] not in self.flist: self.matches.append(fname) Thanks. This was what I was looking for. > 6) Why are you using #~ for comments? This is just the automatic commenting on scite. I put my cursor on the line I want to comment and press ctrl-q ans scite comments out the whole line or selection. As for why the lines are commented; I commented these lines so I could test out some of the code prior to running the next bit. > Also, check out os.path.splitext() > http://docs.python.org/lib/module-os.path.html#l2h-1761 > I will check this out also. Thank You for your help. You have answered some questions for me. Thanks:) SA -- http://mail.python.org/mailman/listinfo/python-list
More List Comparison Help
I have taken into advice what was mentioned earlier, but I have run into a snag in which I am getting the wrong output from my class. > python matchlist.py ./test ./test/list.txt output: ['list.txt', 'test1.txt', 'test2.txt'] set(['test1']) ['', '/', 't', 'e', 's', 't'] The first line of output correctly displays the list of file names in the argv[1] directory. The second line of output correctly displays the set list from readlines on list.txt. The third line of out put should be the same as the 1st line minus the extenxions in the file names. Here is the code: import os from sys import argv class MatchList: def __init__(self, dirList, fileList): self.dirList = os.listdir(dirList) self.fileList = set(open(fileList, 'r').readlines()) self.matchList = [] self.retList = [] self.rut = [] def match(self): for item in dirList: rut = os.path.splitext(item)[0] self.matchList.append(rut) print self.matchList def testPrint(self): print self.dirList print self.fileList self.match() if __name__ == '__main__': if len(argv) == 3: dirList = argv[1] fileListName = argv[2] match = MatchList(dirList, fileListName) match.testPrint() What I want to happen is produce a list of the filenames minus the extensions so that I can set that list. Once that list is set, I can subtract the set list from the readlines function and then use the difference list to determine what files are missing form the directory. Thanks in advance:) SA P.S. Is there a special way to include code in my postings so that it looks different from the rest of the text in the posting? -- http://mail.python.org/mailman/listinfo/python-list
Re: More List Comparison Help
Nevermind. I found my own error. I referenced the input values instead of the class object self. That is what I get for staring at the code too long. Thanks:) SA -- http://mail.python.org/mailman/listinfo/python-list