Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Error while packing keyring module with PY2APP on MAC OSX

I am making an app in python which needs to store keys. I used keyring module to store keys. I am using python-2.7 and osx 10.8.5 with keyring 3.2( easy_install keyring). Code is running fine on eclipse, but when I converted code into app using py2app, it shows error of MYAPP Error open console Terminate

import keyring
keyring.set_password("title","section","keys")
res= keyring.get_password("title","section")

I included terminal response scrap when typed "python setup.py py2app" while making dist through py2app

byte-compiling /Library/Python/2.7/site-packages/keyring-3.2-py2.7.egg/keyring/__init__.py to keyring/__init__.pyc
creating /Users/fis/Desktop/build/bdist.macosx-10.8-intel/python2.7-semi_standalone/app/collect/keyring
byte-compiling /Library/Python/2.7/site-packages/keyring-3.2-py2.7.egg/keyring/backend.py to keyring/backend.pyc
byte-compiling /Library/Python/2.7/site-packages/keyring-3.2-py2.7.egg/keyring/core.py to keyring/core.pyc
byte-compiling /Library/Python/2.7/site-packages/keyring-3.2-py2.7.egg/keyring/errors.py to keyring/errors.pyc
byte-compiling /Library/Python/2.7/site-packages/keyring-3.2-py2.7.egg/keyring/getpassbackend.py to keyring/getpassbackend.pyc
byte-compiling /Library/Python/2.7/site-packages/keyring-3.2-py2.7.egg/keyring/py27compat.py to keyring/py27compat.pyc
byte-compiling /Library/Python/2.7/site-packages/keyring-3.2-py2.7.egg/keyring/util/__init__.py to keyring/util/__init__.pyc
creating /Users/fis/Desktop/build/bdist.macosx-10.8-intel/python2.7-semi_standalone/app/collect/keyring/util
byte-compiling /Library/Python/2.7/site-packages/keyring-3.2-py2.7.egg/keyring/util/platform_.py to keyring/util/platform_.pyc
byte-compiling /Library/Python/2.7/site-packages/keyring-3.2-py2.7.egg/keyring/util/properties.py to keyring/util/properties.pyc
byte-compiling /Library/Python/2.7/site-packages/pathtools-0.1.2-py2.7.egg/pathtools/__init__.pyc to pathtools/__init__.pyc
creating /Users/fis/Desktop/build/bdist.macosx-10.8-intel/python2.7-semi_standalone/app/collect/pathtools
like image 513
imp Avatar asked Nov 08 '13 11:11

imp


1 Answers

Not sure if you ever solved this, but I had a similar issue on my Mac (with python v2.7.6 and py2app v0.9): the script ran fine from the command line (i.e., python scriptname.py), but when I used py2app to convert it to a .app, it failed.

The Console messages led me to conclude that py2app wasn't smart enough to include the submodules from the keyring.backends module. So I explicitly imported everything there and it finally worked:

import keyring.backends.file
import keyring.backends.Gnome
import keyring.backends.Google
import keyring.backends.kwallet
import keyring.backends.multi
import keyring.backends.OS_X
import keyring.backends.pyfs
import keyring.backends.SecretService
import keyring.backends.Windows
import keyring

I hope this helps you!

like image 178
Turix Avatar answered Sep 28 '22 07:09

Turix