pythonw mac error

165 views
Skip to first unread message

concussionGFX

unread,
Sep 8, 2009, 11:39:31 PM9/8/09
to PyInstaller
I have successfully built my app on windows, but now I am getting this
error on mac.

i have tried using no arguments and --onefile and --noconsole.
my app uses wxpython.

This program needs access to the screen.
Please run with 'pythonw', not 'python', and only when you are logged
in on the main display of your Mac.

here is the spec file

# -*- mode: python -*-
a = Analysis([os.path.join(HOMEPATH,'support/_mountzlib.py'),
os.path.join(HOMEPATH,'support/useUnicode.py'), '../trunk/source/
mnr_app.py'],
pathex=['/Pyinst'])
pyz = PYZ(a.pure)
exe = EXE( pyz,
a.scripts,
a.binaries,
a.zipfiles,
a.datas,
name=os.path.join('dist', 'mnr_app'),
debug=False,
strip=False,
upx=False,
console=1 )

app = BUNDLE(exe, appname="MNR_App", version="1.0.0")

Thanks
-Tim

Giovanni Bajo

unread,
Sep 25, 2009, 1:24:12 PM9/25/09
to pyins...@googlegroups.com
On Tue, 2009-09-08 at 20:39 -0700, concussionGFX wrote:
> I have successfully built my app on windows, but now I am getting this
> error on mac.
>
> i have tried using no arguments and --onefile and --noconsole.
> my app uses wxpython.
>
> This program needs access to the screen.
> Please run with 'pythonw', not 'python', and only when you are logged
> in on the main display of your Mac.

Does PyInstaller correctly create a bundle? Does it look like a bundle
from finder? If so, does the error appears even if you click on the
bundle from the finder? And what if you run the bundle using "open
bundlename.app"?

"pythonw" is nothing more than a stub script that executes the
bundle-version of Python from within the bundle, so that Mac OSX
activate GUI support. By creating a bundle with PyInstaller, you should
achieve the same effect and thus it should work.
--
Giovanni Bajo
Develer S.r.l.
http://www.develer.com


Concussion GFX - Tim

unread,
Oct 12, 2009, 3:29:03 PM10/12/09
to pyins...@googlegroups.com
Doing some tests and it seem to have nothing to do with the bundle part of the process.

I get the error from a plain spec file ("makespec.py path/to/script"), and with --onefile

Any ideas?
--
----------------------------------------------------------
Tim Vazquez
(407) 341-5377

CGM Studios
www.cgmstudios.com

Concussion Graphics and Media
www.concussion.cc
----------------------------------------------------------

concussionGFX

unread,
Oct 19, 2009, 8:16:03 PM10/19/09
to PyInstaller
Figured out the issue. The fix that was implemented to get rid of the
double bouncing icon is the cause of my problem. When the attribute in
the plist is set to background, wxpython apps will not work and
complain that they need access to the screen. removing this fixed the
issue. I was able to get rid of the double bouncing icon by using
different plists, but have not been able to do it every time.
sometimes it works, some times it does not.



On Oct 12, 3:29 pm, Concussion GFX - Tim <t...@concussion.cc> wrote:
> Doing some tests and it seem to have nothing to do with the bundle part of the process.
> I get the error from a plain spec file ("makespec.py path/to/script"), and with --onefile
> Any ideas?
> Giovanni Bajo wrote:On Tue, 2009-09-08 at 20:39 -0700, concussionGFX wrote:I have successfully built my app on windows, but now I am getting this error on mac. i have tried using no arguments and --onefile and --noconsole. my app uses wxpython. This program needs access to the screen. Please run with 'pythonw', not 'python', and only when you are logged in on the main display of your Mac.Does PyInstaller correctly create a bundle? Does it look like a bundle from finder? If so, does the error appears even if you click on the bundle from the finder? And what if you run the bundle using "open bundlename.app"? "pythonw" is nothing more than a stub script that executes the bundle-version of Python from within the bundle, so that Mac OSX activate GUI support. By creating a bundle with PyInstaller, you should achieve the same effect and thus it should work.--

mgenti

unread,
Oct 22, 2009, 2:52:39 PM10/22/09
to PyInstaller
Taking out the "LSBackgroundOnly" in the plist file also got rid of
the "pythonw" message for me however it did add the bouncing icon. So
my app does launch now but has the double icon.

On Oct 19, 7:16 pm, concussionGFX <t...@concussion.cc> wrote:
> Figured out the issue. The fix that was implemented to get rid of the
> double bouncing icon is the cause of my problem. When the attribute in
> the plist is set to background, wxpython apps will not work and
> complain that they need access to the screen. removing this fixed the
> issue. I was able to get rid of the double bouncing icon by using
> different plists, but have not been able to do it every time.
> sometimes it works, some times it does not.
>
> On Oct 12, 3:29 pm, Concussion GFX - Tim <t...@concussion.cc> wrote:
>
>
>
> > Doing some tests and it seem to have nothing to do with the bundle part of the process.
> > I get the error from a plain spec file ("makespec.py path/to/script"), and with --onefile
> > Any ideas?
> > Giovanni Bajo wrote:On Tue, 2009-09-08 at 20:39 -0700, concussionGFX wrote:I have successfully built my app on windows, but now I am getting this error onmac. i have tried using no arguments and --onefile and --noconsole. my app uses wxpython. This program needs access to the screen. Please run with 'pythonw', not 'python', and only when you are logged in on the main display of yourMac.Does PyInstaller correctly create a bundle? Does it look like a bundle from finder? If so, does the error appears even if you click on the bundle from the finder? And what if you run the bundle using "open bundlename.app"? "pythonw" is nothing more than a stub script that executes the bundle-version of Python from within the bundle, so thatMacOSX activate GUI support. By creating a bundle with PyInstaller, you should achieve the same effect and thus it should work.--

Giovanni Bajo

unread,
Oct 26, 2009, 10:01:14 AM10/26/09
to pyins...@googlegroups.com
On 10/22/2009 8:52 PM, mgenti wrote:
> Taking out the "LSBackgroundOnly" in the plist file also got rid of
> the "pythonw" message for me however it did add the bouncing icon. So
> my app does launch now but has the double icon.

which is unsurprising, given that that option was added specifically to
remove the double icon.

This is not an acceptable fix for the wxPython issue. Somebody who cares
about this library on Mac should dig more into the code (involving maybe
also the wxPython mailing list) to figure it out how to shut down the
warning.

concussionGFX

unread,
Oct 26, 2009, 10:21:11 AM10/26/09
to PyInstaller
Is it an error with wxPython or PyInstaller?
From what it seems to me, when setting the "LSBackgroundOnly" you are
telling the app to run as a background process, which is why I think
wxpython is complaining when it is trying to build its windows. I
think the error is more with the pyinstaler process that is unpacking
the exe and not quiting, Hence the bouncing icon. I have grabbed
plists from other apps and put them into my app "just to see" what
would happen. some of them do not cause the double icon, and have no
setting for "LSBackgroundOnly", but also have not relevent info about
my app :) here is a plsit from RedGiant that does not cause the double
icon issue.

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://
www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>English</string>
<key>CFBundleDocumentTypes</key>
<array>
<dict>
<key>CFBundleTypeExtensions</key>
<array>
<string>ls3</string>
</array>
<key>CFBundleTypeIconFile</key>
<string>LookPreset.icns</string>
<key>CFBundleTypeName</key>
<string>LookPreset</string>
<key>CFBundleTypeOSTypes</key>
<array>
<string>LS3p</string>
</array>
<key>CFBundleTypeRole</key>
<string>Editor</string>
<key>LSTypeIsPackage</key>
<false/>
<key>NSPersistentStoreTypeKey</key>
<string>XML</string>
</dict>
<dict>
<key>CFBundleTypeExtensions</key>
<array>
<string>l3t</string>
</array>
<key>CFBundleTypeIconFile</key>
<string>ToolPreset.icns</string>
<key>CFBundleTypeName</key>
<string>ToolPreset</string>
<key>CFBundleTypeOSTypes</key>
<array>
<string>LS3t</string>
</array>
<key>CFBundleTypeRole</key>
<string>Editor</string>
<key>LSTypeIsPackage</key>
<false/>
<key>NSPersistentStoreTypeKey</key>
<string>XML</string>
</dict>
</array>
<key>CFBundleExecutable</key>
<string>LooksBuilder</string>
<key>CFBundleGetInfoString</key>
<string>1.2 ©2007-2008 Red Giant Software LLC. All rights reserved.</
string>
<key>CFBundleIconFile</key>
<string>LooksApp</string>
<key>CFBundleIdentifier</key>
<string>com.RedGiantSoftware.LooksBuilder</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>1.2</string>
<key>CFBundleSignature</key>
<string>LS3U</string>
<key>CFBundleVersion</key>
<string>1.2</string>
<key>CSResourcesFileMapped</key>
<true/>
</dict>
</plist>


The i edit it to this and I still do not have the issue:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://
www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>English</string>
<key>CFBundleExecutable</key>
<string>modoArchiver</string>
<key>CFBundleGetInfoString</key>
<string>1.0 ©2009 CGMstudios.com</string>
<key>CFBundleIconFile</key>
<string>MA_App.icns</string>
<key>CFBundleIdentifier</key>
<string>come.cgmstudios.modoArchiver</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>1.2</string>
</dict>
</plist>

Giovanni Bajo

unread,
Oct 26, 2009, 11:06:54 AM10/26/09
to pyins...@googlegroups.com
On 10/26/2009 3:21 PM, concussionGFX wrote:
> Is it an error with wxPython or PyInstaller?
> From what it seems to me, when setting the "LSBackgroundOnly" you are
> telling the app to run as a background process, which is why I think
> wxpython is complaining when it is trying to build its windows. I
> think the error is more with the pyinstaler process that is unpacking
> the exe and not quiting, Hence the bouncing icon.

PyInstaller runs two processes: the first one unpacks the executable,
and then spawns the second, which is the actual program. The first one
needs to stay in background and wait, to clean up the temporary files
even if the second process ends abruptly.

Under Mac OSX, the solution of using LSBackgroundOnly on the first
process works very well with PyQt. I don't know why wxPython complains;
my understanding is that it is over-zealous: it does a check which is
not strictly required. Can you confirm that, if you comment that code
out in wxPython source code, the application works correctly?

If so, we need to raise the discussion with wxPython developers. Notice
that, whatever is the result of that dicussion, we can still workaround
the problem through a runtime hook within PyInstaller.

Mark Guagenti

unread,
Oct 27, 2009, 1:35:38 PM10/27/09
to pyins...@googlegroups.com
I commented out the check and the app does launch but there is no icon
at all. Also, you cannot move the window. I've attached the files I
used to test with.
--Mark
MacTest.spec
TestApp.py
Reply all
Reply to author
Forward
0 new messages