New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OSX app exported by "launcher" module doesn't run #211

Open
aparrish opened this Issue Aug 2, 2016 · 1 comment

Comments

Projects
None yet
2 participants
@aparrish
Contributor

aparrish commented Aug 2, 2016

In standalone command-line Processing.py, the launcher module is supposed to create an application launcher for OSX and Windows. Here's a little sample program:

import launcher; launcher.create()
def setup():
    size(400, 400)
def draw():
    background(0)
    fill(255)
    ellipse(100, 100, mouseX, mouseY)

There are two problems with this: running this program (with java -jar processing.py mouse_follow.py) gives an error like this:

OSError: (20, 'Not a directory', u'<dir of sketch>/libraries') at 170:0 in <dir of sketch>/processing-py.jar/Lib/shutil$py.class

This is easy enough to fix—just create a directory called libraries and re-run.

But then launching the resulting .app (in dist.platforms/mac) doesn't actually run the application. Investigation reveals that the sketch in the exported app is actually re-running the launcher code, creating another dist.platforms directory inside the app bundle. Here's the directory tree of the app bundle before running it:

.
└── Launcher.app
    └── Contents
        ├── Info.plist
        ├── Java
        │   └── processing-py.jar
        ├── MacOS
        │   └── JavaAppLauncher
        ├── PkgInfo
        ├── PlugIns
        ├── Resources
        │   ├── GenericApp.icns
        │   └── en.lproj
        │       └── Localizable.strings
        └── Runtime
            └── sketch.py

... and here's the tree afterward:

.
└── Launcher.app
    └── Contents
        ├── Info.plist
        ├── Java
        │   └── processing-py.jar
        ├── MacOS
        │   └── JavaAppLauncher
        ├── PkgInfo
        ├── PlugIns
        ├── Resources
        │   ├── GenericApp.icns
        │   └── en.lproj
        │       └── Localizable.strings
        └── Runtime
            ├── dist.platforms
            │   ├── mac
            │   │   └── Launcher.app
            │   │       └── Contents
            │   │           ├── Info.plist
            │   │           ├── Java
            │   │           │   └── processing-py.jar
            │   │           ├── MacOS
            │   │           │   └── JavaAppLauncher
            │   │           ├── PkgInfo
            │   │           ├── PlugIns
            │   │           ├── Resources
            │   │           │   ├── GenericApp.icns
            │   │           │   └── en.lproj
            │   │           │       └── Localizable.strings
            │   │           └── Runtime
            │   │               └── sketch.py
            │   └── win
            │       ├── jre
            │       │   └── README.txt
            │       ├── launcher.exe
            │       ├── launcher.ini
            │       ├── processing-py.jar
            │       └── runtime
            │           └── sketch.py
            └── sketch.py

If you actually go into the application bundle and comment out the import launcher; launcher.create() line in Runtime/sketch.py, then the application launches and works fine! So that's a temporary workaround. But, obviously, not ideal.

There's a line in launcher.py that is supposed to stop the launcher module from doing its business if the --internal flag is passed on the JVM command line. I think what's happening is something like this where the arguments from Info.plist are somehow not actually getting passed to the underlying JVM. Thoughts? In an ideal world there would be a way to re-use the (seemingly excellent!) app export code from Python Mode for standalone use on the command line...

For reference, I'm using standalone Processing.py (build 3017) on OSX 10.11.6. Output of java -version:

java version "1.8.0_92"
Java(TM) SE Runtime Environment (build 1.8.0_92-b14)
Java HotSpot(TM) 64-Bit Server VM (build 25.92-b14, mixed mode)
@jdf

This comment has been minimized.

Show comment
Hide comment
@jdf

jdf Aug 3, 2016

Owner

The good news: that's what I call a helpful bug report.

The bad news: I didn't write the export stuff, and don't know anything about it, and don't have any free time any time soon to dive in and address it. In the meantime, "patches welcome". 😐

Owner

jdf commented Aug 3, 2016

The good news: that's what I call a helpful bug report.

The bad news: I didn't write the export stuff, and don't know anything about it, and don't have any free time any time soon to dive in and address it. In the meantime, "patches welcome". 😐

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment