osx - Build app in macosx from python that must run in terminal -


I am trying to create a standalone, double click macoxy app from a python module

 < code> if __name__ == __main__   

line to run it. However, whenever I try to bundle it with something like py2app or pyinstaller, if I bundle an app, then the terminal window does not launch to run the program. Any thoughts on how to get around this? To accept some user input, you need to open the terminal window. I know that more information is needed, this is the first time I have ever tried to do this.

P.S. I was able to do this for windows and package delivery within an installer.

Okay, I got it. Since creating an app bundle from scratch, there is a bit more difficulty on Mac, it is better to find a program that will make it for you, I used applescript to complete it.

First, you need to make your executable Use the command to make your executable if the file which is coming from the Pyro code I used the piinstaller with the --onefile option:

> pyinstaller --onefile yourPythonProgramYouWantToBuild.py

Once created, double click on the file or open it terminal to check that it works All the necessary codes are included from different libraries. If this works, then on the next step.

Open applescript and set a new script.

I have got the point of working here 1) The salescript is found in the directory 2) The compiled executable (manual) app is being placed in the bundle and the script inside the app knows where it is App bundle 3) The exact path is found for the script executable, and it tells the terminal application to run

OK, how to do this?

Make a new applescript, and just enter some dummy code in it, for example:

  Display dialogue "Hello, world!"   

Next, save this applescript as app bundle. The app's package contents are content-> Resources-> Script-> From main.scpt you can navigate in the latest app bundle and navigate between . Now open the main scp file and start editing it.

In your main. Scpt, first find that directory, where applescript

  set the container for the current as "explorer" string end (for me Path)   

However, if you throw in an Apple script in the display dialog current_path , when you run it, from the App Bundle, you will find that this app is bundled Inside you will not be taken in. For example, if you were running the app from the desktop As will the path to ~ / Desktop / would like, which is what we want, because we need to get the path within the app. So next we need to attach some stuff to the end to get the good things within the App Bundle. Use a command similar to this:

  set current_path to current_path & amp; "Dame of the. Ape" & amp; ":" & amp; "TheNameOfYourCompiledExecutable"   

We now have a way for an executable (maybe) in your app bundle. Now, create a POSIX path and run the script to run the terminal Explain. Presently turn on "POSIX" path_Path tell the "terminal" script to finally tell

The last thing is to open the app package contents and execute your onefile in the right place within the app bundle To copy. Change app icon as needed.

Comments

Popular posts from this blog

php - PDO bindParam() fatal error -

logging - How can I log both the Request.InputStream and Response.OutputStream traffic in my ASP.NET MVC3 Application for specific Actions? -

java - Why my included JSP file won't get processed correctly? -