From: <gre...@gm...> - 2004-11-29 18:58:58
|
Hey guys, I tried sending this yesterday, I'm not sure why it didn't go thr= ough. ---------- Forwarded message ---------- From: Gregory Pi=F1ero <gre...@gm...> Date: Sun, 28 Nov 2004 17:37:04 -0500 Subject: Using py2exe with pythoncard To: pyt...@li... Hi everyone, I'm trying to use py2exe on a small pythoncard app I made but when I try to run the exe it says errors occured and in the log file it says: Traceback (most recent call last): File "JobRater.py", line 60, in ? File "PythonCard\model.pyc", line 329, in __init__ File "PythonCard\resource.pyc", line 45, in __init__ File "PythonCard\util.pyc", line 30, in readAndEvalFile IOError: [Errno 2] No such file or directory: 'JobRater.rsrc.py' Unfortunately I'm not sure what the correct method for using py2exe with pythonCard is so I'm not sure if I'm doing something wrong or what. This is my setup.py file: from distutils.core import setup import py2exe setup(windows=3D["JobRater.py"]) And then I just call it as instructed on the py2exe website: >>python setup.py py2exe Any ideas what I could be doing wrong? Below I'll paste JobRater.py and JobRater.rsrc.py just in case there's something wrong in those. Thanks, Greg JobRater.py: #!/usr/bin/python """ __version__ =3D "$Revision: 1.5 $" __date__ =3D "$Date: 2004/04/30 16:26:12 $" """ from PythonCard import model import cPickle from main import ProbData class JobRater(model.Background): def on_initialize(self, event): #get data files datafile=3Dr'C:\Documents and Settings\Gregory\My Documents\1JHUClasses\605.445.71 (AI)\Project\src\data.p' #if find data files load them self.Jobbayes=3DcPickle.load(file(datafile)) unratedjobs_datafilepath=3Dr'C:\Documents and Settings\Gregory\My Documents\1JHUClasses\605.445.71 (AI)\Project\data\trainingdata\unratedjobs.csv' outputfilepath=3Dr'C:\Documents and Settings\Gregory\My Documents\1JHUClasses\605.445.71 (AI)\Project\src\batchoutput.csv' self.unratedjobsfile=3Dfile(unratedjobs_datafilepath) self.newlyratedjobsoutfile=3Dfile(r'C:\Documents and Settings\Gregory\My Documents\1JHUClasses\605.445.71 (AI)\Project\src\newlyratedjobs.csv','a') self.alljobslist=3Dself.unratedjobsfile.readlines() self.updatejobdesc() def on_btngood_mouseClick(self,event): self.Jobbayes.train_from_an_example(True,self.job) self.newlyratedjobsoutfile.write('YES'+','+self.job) self.updatejobdesc() event.Skip() def on_btnbad_mouseClick(self,event): self.Jobbayes.train_from_an_example(False,self.job) self.newlyratedjobsoutfile.write('NO'+','+self.job) self.updatejobdesc() event.Skip() def on_btnExplain_mouseClick(self,event): self.components["txtjobdesc"].text=3Dself.Jobbayes.explainrating(se= lf.job) event.Skip() def on_txtjobdesc_mouseClick(self,event): self.updatejobdesc() event.Skip() def updatejobdesc(self): self.job=3Dself.alljobslist.pop() self.components["txtjobdesc"].text=3Dself.job self.components["lblpercentrating"].text=3Dstr(round(self.Jobbayes.= ratenewjob(self.job)*100,2))+'%' def on_mnuExit_select(self, event): self.close() def on_close(self, event): #save trained data cPickle.dump(self.Jobbayes,file(r'C:\Documents and Settings\Gregory\My Documents\1JHUClasses\605.445.71 (AI)\Project\src\data.p','w')) event.skip() if __name__ =3D=3D '__main__': app =3D model.Application(JobRater) app.MainLoop() JobRater.rsrc.py: {'application':{'type':'Application', 'name':'Template', 'backgrounds': [ {'type':'Background', 'name':'jobview', 'title':'Job Rating', 'position':(271, 69), 'size':(600, 800), 'menubar': {'type':'MenuBar', 'menus': [ {'type':'Menu', 'name':'menuFile', 'label':'&File', 'items': [ {'type':'MenuItem', 'name':'menuFileExit', 'label':'E&xit', 'command':'exit', }, ] }, ] }, 'components': [ {'type':'Button', 'name':'btnExplain', 'position':(337, 14), 'size':(115, 23), 'font':{'style': 'italic', 'faceName': 'Times New Roman', 'family': 'sansSerif', 'size': 8}, 'label':'Explain this rating', }, {'type':'StaticText', 'name':'lblpercentrating', 'position':(227, 9), 'size':(99, 37), 'alignment':'center', 'font':{'faceName': 'Microsoft Sans Serif', 'family': 'sansSerif', 'size': 20}, }, {'type':'StaticText', 'name':'StaticText2', 'position':(6, 18), 'font':{'faceName': 'Microsoft Sans Serif', 'family': 'sansSerif', 'size': 10}, 'text':'Probability that this is a good job is ', }, {'type':'StaticText', 'name':'StaticText1', 'position':(63, 676), 'font':{'faceName': 'Microsoft Sans Serif', 'family': 'sansSerif', 'size': 18}, 'text':'Training:', }, {'type':'Button', 'name':'btnbad', 'position':(181, 661), 'size':(100, 80), 'backgroundColor':(255, 0, 0), 'font':{'faceName': 'Arial Black', 'family': 'sansSerif', 'size': 8}, 'label':'Rate As Bad', }, {'type':'Button', 'name':'btngood', 'position':(281, 661), 'size':(-1, 80), 'backgroundColor':(0, 255, 0), 'font':{'faceName': 'Arial Black', 'family': 'sansSerif', 'size': 8}, 'label':'Rate As Good', }, {'type':'TextArea', 'name':'txtjobdesc', 'position':(0, 60), 'size':(590, 602), 'font':{'faceName': 'Microsoft Sans Serif', 'family': 'sansSerif', 'size': 12}, }, ] # end components } # end background ] # end backgrounds } } |