Re: program with raw_input prompt behaves differently after compile
It was kindof a stupid mistake on my part: I had to put 'import os' at the very beginning, and not only in one of my two function definitions. Thanks anyway, thanks to your link I also found how to change the colour of the console...neat :p ! Tim Hans Nowak wrote: tim wrote: I want to write a program that looks into a given folder, groups files that have a certain part of the filename in common and then copy those groups one at a time to another place, using the raw_input prompt to continue or break. [...] It works fine when I run this from PythonWin IDE, but after compiling an executable from it (py2exe) it exits whatever I type in the 'continue?' prompt. What am I doing wrong? Maybe this helps: http://forums.devshed.com/python-programming-11/eof-error-with-raw-input-from-a-exe-text-color-187633.html The solution described here was to compile the program as a console app, rather than a Windows app. -- http://mail.python.org/mailman/listinfo/python-list
Re: program with raw_input prompt behaves differently after compile
tim wrote: I want to write a program that looks into a given folder, groups files that have a certain part of the filename in common and then copy those groups one at a time to another place, using the raw_input prompt to continue or break. [...] It works fine when I run this from PythonWin IDE, but after compiling an executable from it (py2exe) it exits whatever I type in the 'continue?' prompt. What am I doing wrong? Maybe this helps: http://forums.devshed.com/python-programming-11/eof-error-with-raw-input-from-a-exe-text-color-187633.html The solution described here was to compile the program as a console app, rather than a Windows app. -- Hans Nowak http://zephyrfalcon.org/ -- http://mail.python.org/mailman/listinfo/python-list
program with raw_input prompt behaves differently after compile
I want to write a program that looks into a given folder, groups files that have a certain part of the filename in common and then copy those groups one at a time to another place, using the raw_input prompt to continue or break. here's what I have: ### def makegroepen(): global p import os from longestcommonprefix import longestcommonprefix p = raw_input('path') l = os.listdir(p) l.sort() groepen=[] groep=[] basenames=[] for r in l: if r.find('_poly16.mp3'): baselist = r.split('_') mopobasename = baselist[0] if mpbasename not in basenames: basenames.append(mpbasename) for s in l: if longestcommonprefix([s,mpbasename])==mpbasename: print mpbasename if s not in groep: groep.append(s) if len(groep)==6: groepen.append(groep) groep=[] print groepen return groepen def movegr(): global p, groepen for t in groepen: contprompt=raw_input('continue? (n to stop)') if contprompt=='n': break for curr in t: if os.path.isfile(p+'\\'+curr): tempfile = open(p+'\\'+curr, 'rb') tempfile.seek(0) tempfilecont = tempfile.read() dircondition = os.path.exists('c:\\content\\workfolder') if dircondition == False: os.makedirs('c:\\content\\workfolder') destfile = open('c:\\content\\workfolder\\'+curr, 'wb') destfile.write(tempfilecont) destfile.close() if __name__=='__main__': global groepen groepen = makegroepen() movegr() (I renamed 'commonprefix' to 'longestcommonprefix', it is actually just the 'binary search version' I found at http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/252177 ) It works fine when I run this from PythonWin IDE, but after compiling an executable from it (py2exe) it exits whatever I type in the 'continue?' prompt. What am I doing wrong? Thanks, Tim -- http://mail.python.org/mailman/listinfo/python-list