Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8963041
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T16:16:20+00:00 2026-06-15T16:16:20+00:00

I have a python script which makes a GUI. When a button ‘Run’ is

  • 0

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.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T16:16:21+00:00Added an answer on June 15, 2026 at 4:16 pm

    py2app (or rather, setup.py) doesn’t magically include files, just because you import them in your application code.

    From your description it’s not quite clear to me where the predictmiP.py file is located, where the mip3.py file is located, where the setup.py file is located, and how the rest of the directory tree looks.

    So, a few general notes on packaging Python files (see also http://docs.python.org/2.7/distutils/index.html). If you just have a few files, you can list them explicitly:

    setup(
        py_modules=['file1', 'file2']
    )
    

    This would include file1.py and file2.py. If you have lots of files, that gets tedious, of course, so you can tell setup.py to include all Python files it finds, like so:

    setup(
        package='example',
    )
    

    This expects a directory named example, containing an __init__.py, and will include all Python files found there.

    If you have a different directory layout, e.g. a src directory containing the Python files, set it like this:

    setup(
        package='example',
        package_dir={'': 'src'}
    )
    

    This expects a directory src/example, and includes the Python files below there.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have python script which downloads N number of images from website. I run
I have a python script that runs a program, which generates few .exe files
I have a list which I have obtained from a python script. the content
I have this python script which is supposed to wrap all that look like
I have a python script which runs and generates a version-file. I use the
I have a python script that makes an attribute table of a raster. This
I have a Python CGI script from which I am trying to call a
I have a python script which outputs lots of data, sample is as below.
i have a python script which keeps crashing on: subprocess.call([pdftotext, pdf_filename]) the error being:
I have a small python script which draws some turtle graphics. When my script

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.