I have a python script which makes a GUI. When a button 'Run' is pressed in this GUI it runs a function from an imported package (which I made) like this
from predictmiP import predictor
class MiPFrame(wx.Frame):
[...]
def runmiP(self, event):
predictor.runPrediction(self.uploadProtInterestField.GetValue(), self.uploadAllProteinsField.GetValue(), self.uploadPfamTextField.GetValue(), \
self.edit_eval_all.Value, self.edit_eval_small.Value, self.saveOutputField)
When I run the GUI directly from python it all works well and the program writes an output file. However, when I make it into an app, the GUI starts but when I press the button nothing happens. predictmiP does get included in build/bdist.macosx-10.3-fat/python2.7-standalone/app/collect/, like all the other imports I'm using (although it is empty, but that's the same as all the other imports I have).
How can I get multiple python files, or an imported package to work with py2app?
my setup.py:
""" This is a setup.py script generated by py2applet
Usage: python setup.py py2app """
from setuptools import setup
APP = ['mip3.py']
DATA_FILES = []
OPTIONS = {'argv_emulation': True}
setup(
app=APP,
data_files=DATA_FILES,
options={'py2app': OPTIONS},
setup_requires=['py2app'],
)
edit:
It looked like it worked, but it only works for a little. From my GUI I call
blast.makeBLASTdb(self.uploadAllProteinsField.GetValue(), 'allDB')
# to test if it's working
dlg = wx.MessageDialog( self, "werkt"+self.saveOutputField, "werkt", wx.OK)
dlg.ShowModal() # Show it
dlg.Destroy() # finally destroy it when finished.
blast.makeBLASTdb looks like this:
def makeBLASTdb(proteins_file, database_name):
subprocess.call(['/.'+os.path.realpath(__file__).rstrip(__file__.split('/')[-1])+'blast/makeblastdb', '-in', proteins_file, '-dbtype', 'prot', '-out', database_name])
This function gets called, makeblastdb which I call through subprocess does output a file. However, the program does not continue,
dlg = wx.MessageDialog( self, "werkt"+self.saveOutputField, "werkt", wx.OK)
dlg.ShowModal() # Show it
in the next lines never gets executed.